• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Monster类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Monster的典型用法代码示例。如果您正苦于以下问题:C# Monster类的具体用法?C# Monster怎么用?C# Monster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Monster类属于命名空间,在下文中一共展示了Monster类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Update

 /**
  * Update plays the "Sleep" animation over and over
  */
 public virtual void Update( Monster _monster )
 {
     if( !_monster.animation.isPlaying )
     {
         _monster.animation.PlayQueued( "Sleep", QueueMode.CompleteOthers );
     }
 }
开发者ID:gianlucadelfino,项目名称:Finite-State-Machine-Pattern,代码行数:10,代码来源:RestState.cs


示例17: Monster

    public Monster(Monster data)
    {
        title = data.title;
        type = data.type;
        stats = data.stats;
        desc = data.desc;
        flavour = data.flavour;
        flines = data.flines;
        level = data.level;
        image = data.image;
        back = data.back;
        front = data.front;
        id = data.id;
        picture = data.picture;
        cardpower = data.cardpower;
        bannerframe = data.bannerframe;

        current_health = data.current_health;
        max_health = data.max_health;
        faith = data.faith;
        spirit = data.spirit;
        strength = data.strength;
        defense = data.defense;
        dexterity = data.dexterity;

        health_scale = data.health_scale;
        faith_scale = data.faith_scale;
        spirit_scale = data.spirit_scale;
        strength_scale = data.strength_scale;
        defense_scale = data.defense_scale;

        level = data.level;
    }
开发者ID:Kallen330,项目名称:Scripts,代码行数:33,代码来源:Monster.cs


示例18: MonsterState

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="monster">monster handle</param>
		public MonsterState(Monster monster)
		{
			if (monster == null)
				throw new ArgumentNullException("monster");

			Monster = monster;
		}
开发者ID:melkor54248,项目名称:dungeoneye,代码行数:11,代码来源:MonsterState.cs


示例19: AssignMonsterStats

        private Monster AssignMonsterStats(Monster monster, CombatContext combatContext)
        {
            monster.BaseStats = _statsGenerator.GenerateStats(monster.Class);

            monster.SetActionSelector(_actionSelector);
            monster.SetCombatContext(combatContext);

            monster.CurrentHitPoints = monster.MaxHitPoints;
            monster.CurrentEnergy = monster.MaxEnergy;

            var bossMultiplier = monster.IsBoss ? 4 : 1;

            monster.Gold = monster.Level * _dice.Roll(3 * bossMultiplier, 6);
            monster.Experience = (monster.Level * _dice.Roll(2 * bossMultiplier, 6));

            if (monster.IsBoss)
            {
                monster.Weapon = weaponFactory.CreateWeapon(monster.Level + 1, true);
            }
            else
            {
                if (_dice.Random(1, 6) == 1)
                {  // 1/6 monsters will have a weapon
                    monster.Weapon = weaponFactory.CreateWeapon(monster.Level, false);
                }
            }

            monster = Itemize(monster);

            return monster;
        }
开发者ID:ServerGame,项目名称:NullQuest,代码行数:31,代码来源:MonsterFactory.cs


示例20: UseTactic

        public override bool UseTactic(IGameEngineCore engine, Monster monster)
        {
            if (IsPlayerVisible(engine, monster))
            {
                List<Point> pathToPlayer = GetPathToPlayer(engine, monster);

                if (IsNextToPlayer(engine, pathToPlayer))
                {
                    if (AttackPlayer(engine, monster))
                        return true;
                }

                if (HasPathToPlayer(engine, pathToPlayer))
                {
                    if (MoveOnPath(engine, pathToPlayer, monster))
                        return true;
                }
            }
            else
            {
                if (WalkTowardsLastKnownPosition(engine, monster))
                    return true;
            }
            WanderRandomly(engine, monster);   // We have nothing else to do, so wander                
            return true;
        }
开发者ID:donblas,项目名称:magecrawl,代码行数:26,代码来源:DefaultTactic.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Month类代码示例发布时间:2022-05-24
下一篇:
C# Monodoc类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap