本文整理汇总了C#中Monster类的典型用法代码示例。如果您正苦于以下问题:C# Monster类的具体用法?C# Monster怎么用?C# Monster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Monster类属于命名空间,在下文中一共展示了Monster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Factory
private float startx = -2.0f; //몬스터들 의위 치값 을관리하 는변
#endregion Fields
#region Methods
IEnumerator Factory()
{
//대 기시간 을랜덤함수 로이용하 여제작
float time = Random.Range(3.0f, 5.0f);
// 3.0 초만큼 대기하라. 3 초 대기 후 아래 루틴 실행
yield return new WaitForSeconds(time);
int random = Random.Range(0, 5);
Monster[] otherMonster = new Monster[4];
int monsterCount = 0;
Monster fireMonster = null;
for(int i=0; i< count; ++i)
{
if(i == random){
GameObject obj = Instantiate(fireEnemy) as GameObject;
obj.transform.position = new Vector2(startx, 3.5f);
fireMonster = obj.GetComponent<Monster>();
}
else{
GameObject obj = Instantiate(enemy) as GameObject;
obj.transform.position = new Vector2(startx, 3.5f);
otherMonster[monsterCount] = obj.GetComponent<Monster>();
monsterCount++;
}
startx += 1;
}
fireMonster.SetMonster(otherMonster);
startx = -2.0f;
StartCoroutine(Factory());
}
示例2: CheckFirstStrike
/// <summary>
/// Check that hero attack is first
/// </summary>
/// <param name="parMonster">Monster</param>
/// <returns>First attack</returns>
public override bool CheckFirstStrike(Monster parMonster)
{
FirstStrike = true;
bool first = base.CheckFirstStrike(parMonster);
FirstStrike = true;
return first;
}
示例3: Awake
void Awake()
{
alertArea = GetComponent<SphereCollider>();
monster = GetComponent<Monster>();
player = GameObject.FindGameObjectWithTag(Tags.player);
layers = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<Layers>();
}
示例4: deerAI
public static void deerAI(Monster monster, Quinoa quinoa)
{
if (monster.readyForCommand())
{
MonsterActionManager.setMoveCommand(monster, EnumUtil.RandomEnumValue<Direction>());
}
}
示例5: Start
private float idleSwitchDelay; // A random time to play RandomIdle animation
void Start () {
monster = GetComponent<Monster>();
animation = monster.monsterGameObject.GetComponent<Animation>();
// Initialize monster animator
if(animationClips.idle != null)
animation.AddClip(animationClips.idle, "Idle");
if(animationClips.randomIdle != null) {
animation.AddClip(animationClips.randomIdle, "RandomIdle");
idleSwitchDelay = (Length("Idle") * UnityEngine.Random.Range(4, 8)) + Time.time;
}
if(animationClips.moveForward != null)
animation.AddClip(animationClips.moveForward, "MoveForward");
if(animationClips.moveBackward != null)
animation.AddClip(animationClips.moveBackward, "MoveBackward");
if(animationClips.physicalAttack != null)
animation.AddClip(animationClips.physicalAttack, "PhysicalAttack");
if(animationClips.specialAttack != null)
animation.AddClip(animationClips.specialAttack, "SpecialAttack");
if(animationClips.takeDamage != null)
animation.AddClip(animationClips.takeDamage, "TakeDamage");
if(animationClips.dead != null)
animation.AddClip(animationClips.dead, "Dead");
Play("Idle");
}
示例6: MoveState
/// <summary>
/// Constructor
/// </summary>
/// <param name="monster">Monster handle</param>
/// <param name="range">Range of the target</param>
/// <param name="direction">Direction of the target</param>
public MoveState(Monster monster, int range, CardinalPoint direction) : base(monster)
{
TargetRange = range;
TargetDirection = direction;
TargetLocation = new DungeonLocation(Monster.Location);
TargetLocation.Offset(direction, range);
}
示例7: Start
void Start () {
monster = GameData.activeMonster;
species.text = monster.species;
if (monster.hatched) {
eggModel.gameObject.SetActive(false);
monsterName.text = monster.name;
birthday.text = "" + monster.birthday.ToString("MMMM dd, yyyy") +
"\nat " + monster.birthday.ToString("h:mm tt");
int days = (DateTime.Now - monster.birthday).Days;
age.text = "" + days + " days old";
currentLevel.text = "" + monster.level;
nextLevel.text = "" + (monster.level+1);
float xpScale = (float)monster.xp / (float)monster.xpToNextLevel;
Vector3 ls = xpBar.localScale;
ls.x = xpScale;
xpBar.localScale = ls;
float care = (float)monster.care;
int whichCare = (int)(Math.Ceiling(care/2) - 1);
for(int i = 0; i <= whichCare; i++){
if(i == whichCare && care % 2 == 1){
hearts[i].sprite = halfHeart;
}else{
hearts[i].sprite = fullHeart;
}
}
} else {
monsterModel.gameObject.SetActive(false);
birthday.text = "Not hatched!";
age.text = "???";
currentLevel.text = "?";
nextLevel.text = "?";
}
}
示例8: getCost
public float getCost(Monster mover, int x, int y, int tx, int ty)
{
float dx = tx - x;
float dy = ty - y;
return ((dx * dx) + (dy * dy));
}
示例9: pickMateButton
public void pickMateButton(MonsterUnit m)
{
Monster t = m.getUnit();
unitMonster = new Monster(unitMonster, t);
setColors();
updateUnitText();
}
示例10: CalculateDamage
/// <summary>
/// 伤害核心计算公式
/// </summary>
/// <param name="monster">怪物</param>
/// <param name="skillDamage">已经过法强加成的伤害类</param>
/// <returns>计算抗性后的伤害值</returns>
public static float CalculateDamage(Monster monster, Damage.SkillDamage skillDamage)
{
///当前版本不存在神圣伤害or物理伤害
if (!monster.armorComponent)
{
return skillDamage.GetTotalDamage();
}
float[] elementDefenceList = monster.armorComponent.GetElementDefenceList();
float sum = 0;
for (int i = 0; i < Elements.ELEMENT_NUMBER; i++)
{
///当前版本不存在将伤害小于0的效果
if (skillDamage.elementsDamage[i] < 0)
{
skillDamage.elementsDamage[i] = 0;
}
///当前版本不存在将伤害转化成治疗的效果
float p = 1 - elementDefenceList[i] / 100;
if (p < 0)
{
p = 0;
}
sum += skillDamage.elementsDamage[i] * p;
}
///FIXME 物理组件存在物理抗性,物理抗性还需计算
return sum + skillDamage.physicalDamage;
}
示例11: NewOrc
public static Character NewOrc( Vector3 location )
{
Monster orc = new Monster();
orc.Name = "Orc";
if (UnityEngine.Random.value > 0.5)
orc.MaleLayers.Add("TempSprites/Materials/ork");
else
orc.MaleLayers.Add("TempSprites/Materials/orc2");
orc.FemaleLayers = orc.MaleLayers;
SetStats(orc, 3, 1, 2,25);
orc.AddSkill(SkillFactory.FindSkillByName("Swords"), 1);
orc.AddSkill(SkillFactory.FindSkillByName("Tough"), 2);
orc.AddSkill(SkillFactory.FindSkillByName("Cleave"), 2);
orc.InventoryItems.GoldCoins = (int)UnityEngine.Random.Range(10,20);
orc.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon);
orc.EquipItem(ItemFactory.FindItemByName("Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso);
orc.BackpackItem(ItemFactory.FindItemByName("Watermelon"));
orc.Smarts = new FightOrFlight();
return AttachToGame(orc, location,1.45f);
}
示例12: NewSkellymans
public static Character NewSkellymans(Vector3 location)
{
Monster mon = new Monster();
mon.Name = "Skellyman";
bool isFancy = UnityEngine.Random.value < 0.25;
if (!isFancy)
mon.MaleLayers.Add("TempSprites/Materials/skeleton");
else
{
mon.MaleLayers.Add("TempSprites/Materials/skeleton_chain");
mon.Name = "Dire " + mon.Name;
}
mon.FemaleLayers = mon.MaleLayers;
if (isFancy)
SetStats(mon, 2, 1, 1, 25);
else
SetStats(mon, 3, 0, 2, 50);
mon.AddSkill(SkillFactory.FindSkillByName("Swords"), isFancy ? 4 : 2);
mon.InventoryItems.GoldCoins = 0;
mon.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon);
mon.EquipItem(ItemFactory.FindItemByName( isFancy ? " Mail Armor" : "Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso);
// mon.BackpackItem(ItemFactory.FindItemByName("Watermelon"));
mon.Smarts = new FightToDeath(0.75f);
return AttachToGame(mon, location,1.25f);
}
示例13: UseTactic
public override bool UseTactic(IGameEngineCore engine, Monster monster)
{
bool usedSkill = engine.MonsterSkillEngine.UseSkill(monster, MonsterSkillType.SlingStone, engine.Player.Position);
if (usedSkill)
UsedCooldown(monster, CooldownName, CooldownAmount);
return usedSkill;
}
示例14: NewBandit
public static Character NewBandit(Vector3 location)
{
Monster mon = new Monster();
mon.Name = "Bandit";
if (UnityEngine.Random.value > 0.125)
mon.MaleLayers.Add("TempSprites/Materials/bandit");
else
{
mon.MaleLayers.Add("TempSprites/Materials/bandit_cheif");
mon.Name = "Fancy Bandit";
}
mon.FemaleLayers = mon.MaleLayers;
SetStats(mon, 2, 2, 2, 25);
mon.AddSkill(SkillFactory.FindSkillByName("Swords"), 3);
mon.InventoryItems.GoldCoins = (int)UnityEngine.Random.Range(20, 120);
mon.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon);
mon.EquipItem(ItemFactory.FindItemByName("Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso);
mon.BackpackItem(ItemFactory.FindItemByName("Watermelon"));
mon.Smarts = new FightOrFlight(0.3f,0.5f);
return AttachToGame(mon, location,1.25f);
}
示例15: CreateMonster
public Monster CreateMonster(int loadedLevel, int waypoint, GameObject enemyObj)
{
EnemyObject = enemyObj;
monster = null;
string minionName = "Generic Minion";
string bossName = "Generic Boss";
switch (loadedLevel)
{
case 1:
minionName = "Troll Minion";
bossName = "Troll King";
break;
case 2:
minionName = "Golem Minion";
bossName = "Golem Boss";
break;
case 3:
minionName = "Lava Minion";
bossName = "Lava Boss";
break;
}
SpawnEnemy(minionName, bossName, loadedLevel, waypoint);
Debug.Log("Building level " + loadedLevel + " Enemy.\nName: " + monster.Name + "\nWaypoint: " + waypoint);
return monster;
}