当前位置: 首页>>代码示例>>C#>>正文


C# Monster类代码示例

本文整理汇总了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());
    }
开发者ID:kgmhk,项目名称:unity_practice,代码行数:40,代码来源:MonsterManager.cs

示例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;
 }
开发者ID:vkd,项目名称:DesktopDungeons,代码行数:12,代码来源:Rogue.cs

示例3: Awake

 void Awake()
 {
     alertArea = GetComponent<SphereCollider>();
     monster = GetComponent<Monster>();
     player = GameObject.FindGameObjectWithTag(Tags.player);
     layers = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<Layers>();
 }
开发者ID:rpfypust,项目名称:RealisticPerspective,代码行数:7,代码来源:MonsterAI.cs

示例4: deerAI

 public static void deerAI(Monster monster, Quinoa quinoa)
 {
     if (monster.readyForCommand())
     {
         MonsterActionManager.setMoveCommand(monster, EnumUtil.RandomEnumValue<Direction>());
     }
 }
开发者ID:seaweedfactory,项目名称:LumberjackRL,代码行数:7,代码来源:MonsterAI.cs

示例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");
    }
开发者ID:Jian881219,项目名称:TurnBasedBattleKit,代码行数:32,代码来源:MonsterAnimator.cs

示例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);
		}
开发者ID:melkor54248,项目名称:dungeoneye,代码行数:13,代码来源:Move.cs

示例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 = "?";
		}
	}
开发者ID:riyoyukai,项目名称:Capstone-3.0,代码行数:33,代码来源:ProfileLoader.cs

示例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));
        }
开发者ID:seaweedfactory,项目名称:LumberjackRL,代码行数:7,代码来源:ClosestSquaredHeuristic.cs

示例9: pickMateButton

 public void pickMateButton(MonsterUnit m)
 {
     Monster t = m.getUnit();
     unitMonster = new Monster(unitMonster, t);
     setColors();
     updateUnitText();
 }
开发者ID:jaygon4146,项目名称:GenePoolPrototype,代码行数:7,代码来源:MonsterUnit.cs

示例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;
 }
开发者ID:shuitian,项目名称:LonelyCity,代码行数:33,代码来源:Damage.cs

示例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);
    }
开发者ID:JeffM2501,项目名称:CSC370,代码行数:27,代码来源:MonsterFactory.cs

示例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);
    }
开发者ID:JeffM2501,项目名称:CSC370,代码行数:32,代码来源:MonsterFactory.cs

示例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;
 }
开发者ID:donblas,项目名称:magecrawl,代码行数:7,代码来源:UseSlingStoneTactic.cs

示例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);
    }
开发者ID:JeffM2501,项目名称:CSC370,代码行数:28,代码来源:MonsterFactory.cs

示例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;
    }
开发者ID:Zanion,项目名称:Ascent_of_Numrock,代码行数:29,代码来源:EnemyFactory.cs


注:本文中的Monster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。