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


C# Enemy类代码示例

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


Enemy类属于命名空间,在下文中一共展示了Enemy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    // Use this for initialization
    void Start()
    {
        pool = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent<DungeonManager>().getPool();

        enemyList = new List<Enemy>();
        string path = Application.dataPath + @"/Resources/XML/EnemyList.xml";
        XmlReader xmlReader = XmlReader.Create(path);
        while(xmlReader.Read ())
        {
            if((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "Enemy"))
            {
                if(xmlReader.HasAttributes)
                {
                    if (xmlReader.GetAttribute("pool") == pool)
                    {
                        Enemy tempEnemy = new Enemy();
                        tempEnemy.charName = xmlReader.GetAttribute("name");
                        //tempEnemy. = xmlReader.GetAttribute("desc");
                        tempEnemy.health = int.Parse(xmlReader.GetAttribute("health"));
                        tempEnemy.strength = int.Parse(xmlReader.GetAttribute("str"));
                        tempEnemy.endurance = int.Parse(xmlReader.GetAttribute("end"));
                        tempEnemy.agility = int.Parse(xmlReader.GetAttribute("agi"));
                        tempEnemy.magicSkill = int.Parse(xmlReader.GetAttribute("mag"));
                        tempEnemy.luck = int.Parse(xmlReader.GetAttribute("luck"));
                        tempEnemy.range = int.Parse(xmlReader.GetAttribute("range"));
                        tempEnemy.drop = xmlReader.GetAttribute("drop");
                        tempEnemy.image = xmlReader.GetAttribute("image");
                        enemyList.Add(tempEnemy);
                    }
                }
            }
        }
        //Debug.Log("Possible enemies: " + enemyList.Count);
        populateFloor();
    }
开发者ID:cmortimer,项目名称:403NameNotAccessible,代码行数:36,代码来源:SpawnEnemies.cs

示例2: ShowEffect

    public void ShowEffect(Enemy enemy)
    {
        if(Effectt_Prb == null)
        {
            Effectt_Prb = Resources.Load("eft/Gamora/SkillEft_GAMORA30AB") as GameObject;
        }

        GameObject front = Instantiate(Effectt_Prb) as GameObject;
        front.transform.parent = enemy.transform;
        front.transform.localPosition = new Vector3(0,500,-15);

        GameObject behind = Instantiate(Effectt_Prb) as GameObject;
        behind.transform.parent = enemy.transform;
        behind.transform.localPosition = new Vector3(0,500,100);

        effects.Add(front);
        effects.Add(behind);
        if (targets.ContainsKey(enemy.getID())){
            targets[enemy.getID()] = effects.Count-2;
        }
        else{
            targets.Add(enemy.getID(), effects.Count-2);
        }

        PackedSprite ps = front.GetComponent<PackedSprite>();
        ps.Color = new Color(ps.Color.r, ps.Color.g,ps.Color.b,0.5f);
    }
开发者ID:rogeryuan99,项目名称:Hello,代码行数:27,代码来源:Skill_GAMORA30B.cs

示例3: getPosInEnemyBody

 public Vector3 getPosInEnemyBody(Enemy enemy)
 {
     BoxCollider bc = enemy.collider as BoxCollider;
     float randomX = UnityEngine.Random.Range(bc.bounds.min.x,bc.bounds.max.x);
     float randomY  = UnityEngine.Random.Range(bc.bounds.min.y,bc.bounds.max.y);
     return new Vector3(randomX, randomY,0);
 }
开发者ID:rogeryuan99,项目名称:Hello,代码行数:7,代码来源:Skill_GROOT30B.cs

示例4: Start

    // Use this for initialization
    IEnumerator Start()
    {
        spaceship = GetComponent<Spaceship> ();
        common = GetComponent<EnemyCommon>();
        enemy = GetComponent<Enemy>();
        common.Init();

        //SE関係
        audioSource = gameObject.GetComponent<AudioSource>();
        audioSource.clip = shootSE;
        //

        s2 = common.CreateShotPosition();
        pt = FindObjectOfType<Party>().transform;

        //FindObjectOfType<MessageWindow>().showMessage("メテオ");

        yield return new WaitForEndOfFrame();

        //StartCoroutine("Stop");

        StartCoroutine("Attack1");

        yield break;
    }
开发者ID:jansou,项目名称:ScrollShooting,代码行数:26,代码来源:DummyBom.cs

示例5: Main

    static void Main(String[] args)
    {
        string[] inputs;

        // game loop
        while (true)
        {
            int count = int.Parse(Console.ReadLine()); // The number of current enemy ships within range
            Console.Error.WriteLine("Count:" + count);
            
            Enemy[] enemys = new Enemy[count];
            
            for (int i = 0; i < count; i++)
            {
                inputs = Console.ReadLine().Split(' ');
                enemys[i] = new Enemy(inputs[0], int.Parse(inputs[1]));
            }

            Array.Sort(enemys, delegate(Enemy en1, Enemy en2) {
                    return en1.Dist.CompareTo(en2.Dist);
                  });
                  
            Console.WriteLine(enemys[0].Name);
        }
    }
开发者ID:singhnikhil909,项目名称:codingame-puzzles,代码行数:25,代码来源:Onboarding.cs

示例6: EnemyAggro

	public EnemyAggro(Enemy enemy, Transform target) : base(enemy)
	{
		this.target = target;
		enemy.navMeshAgent.SetDestination (target.position);
		enemy.navMeshAgent.Resume ();
		Begin();
	}
开发者ID:owenllharris,项目名称:GGJ_16,代码行数:7,代码来源:EnemyAggro.cs

示例7: Activate

        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                gameFont = content.Load<SpriteFont>(@"Game\gamefont");

                // La map
                //Texture2D grassTexture = content.Load<Texture2D>("grass");
                //Texture2D pathTexture = content.Load<Texture2D>("path");
                level.AddTexture(content.Load<Texture2D>(@"Game\Levels\grass"));
                level.AddTexture(content.Load<Texture2D>(@"Game\Levels\path"));

                // Enemy
                //Texture2D enemyTexture = content.Load<Texture2D>("enemy");
                enemy = new Enemy(content.Load<Texture2D>(@"Game\Enemies\enemy"), Vector2.Zero, 100, 10, 0.5f);
                enemy.SetWaypoints(level.Waypoints);

                // Player
                //Texture2D towerTexture = content.Load<Texture2D>("ARROW");
                player1 = new Player(this.level, content.Load<Texture2D>(@"Game\Towers\arrow"));

                // A real game would probably have more content than this sample, so
                // it would take longer to load. We simulate that by delaying for a
                // while, giving you a chance to admire the beautiful loading screen.
                //Thread.Sleep(1000);

                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }
        }
开发者ID:faudeval,项目名称:projet,代码行数:38,代码来源:GameplayScreen.cs

示例8: e_Visit

 public override Status e_Visit(Enemy en)
 {
     if (e_Predicate(en))
         return Status.Success;
     else
         return Status.Fail;
 }
开发者ID:janPierdolnikParda,项目名称:RPG,代码行数:7,代码来源:e_Assert.cs

示例9: EnemyDie

 // update enemy kill counter
 public void EnemyDie(Enemy enemy)
 {
     // update kill amount
     KillCountAmount ();
     // add gold amount
     GoldCountAmount (enemy.gold);
 }
开发者ID:dujos,项目名称:TowerD,代码行数:8,代码来源:UIController.cs

示例10: CatWolfAI

 public CatWolfAI(Enemy catwolf)
     : base(catwolf)
 {
     viewRange = 15f;
     distantToPlayer = 1.3f;
     person = (CatWolf)_person;
 }
开发者ID:HetongWang,项目名称:dark-conqueror,代码行数:7,代码来源:CatWolfAI.cs

示例11: FindEnemy

    // ���ҵ���
    void FindEnemy()
    {
        m_targetEnemy = null;

        int lastlife = 0;
        foreach (Enemy enemy in GameManager.Instance.m_EnemyList)
        {
            if (enemy.m_life == 0)
                continue;

            Vector3 pos1 = this.transform.position;
            Vector3 pos2 = enemy.transform.position;

            float dist=Vector2.Distance(new Vector2(pos1.x, pos1.z), new Vector2(pos2.x, pos2.z));

            if (dist > m_attackArea)
                continue;

            if (lastlife == 0 || lastlife > enemy.m_life)
            {
                m_targetEnemy = enemy;

                lastlife = enemy.m_life;
            }
        }
    }
开发者ID:Wholanz,项目名称:Tower,代码行数:27,代码来源:Defender.cs

示例12: addThreat

    public void addThreat(CRController source, float threat)
    {
        int i=0;
        for (; i<_enemies.Count; i++)
        {
            Enemy enemy = _enemies[i];
            if (enemy.controller == source)
            {
                enemy.threat = enemy.threat + threat;
                _enemies[i] = enemy;
                break;
            }
        }

        if (i >= _enemies.Count)
        {
            Enemy enemy = new Enemy();
            enemy.controller = source;
            enemy.threat = threat;

            _enemies.Add(enemy);
        }
        else
        {
            if (i > 0 && _enemies[i].threat > _enemies[i-1].threat)
            {
                Enemy tmp = _enemies[i];
                _enemies[i] = _enemies[i-1];
                _enemies[i-1] = tmp;
            }
        }

        updateTarget();
    }
开发者ID:silantzis,项目名称:quest,代码行数:34,代码来源:NPCThreat.cs

示例13: RotopollyAI

 public RotopollyAI(Enemy c)
     : base(c)
 {
     viewRange = 20f;
     person = (Rotopolly)_person;
     comboChance = person.setting.runComboChance;
 }
开发者ID:HetongWang,项目名称:dark-conqueror,代码行数:7,代码来源:RotopollyAI.cs

示例14: OnEnemyInstantiate

 void OnEnemyInstantiate(Enemy enemy)
 {
     _enemies[_index++] = enemy;
     enemy.name = pfEnemy.name;
     enemy.spawner = this;
     enemy.Respawn();
 }
开发者ID:Lobo-Prix,项目名称:TeraTale,代码行数:7,代码来源:MonsterSpawner.cs

示例15: PlayerEnemyCollide

 public void PlayerEnemyCollide(Player player, Enemy enemy)
 {
     Rectangle playerBox = player.state.GetBoundingBox(player.position);
     Rectangle enemyBox = enemy.state.GetBoundingBox(enemy.position);
     Rectangle intersection = Rectangle.Intersect(playerBox, enemyBox);
     player.interactable = true;
     player.interactEnemy = enemy;
     if (intersection.Height > intersection.Width)
     {
         if (playerBox.Right > enemyBox.Left && playerBox.Right < enemyBox.Right)
         {
             player.position.X -= intersection.Width; // left
         }
         else
         {
             player.position.X += intersection.Width; // right
         }
     }
     else if (intersection.Height < intersection.Width)
     {
         if (playerBox.Bottom > enemyBox.Top && playerBox.Bottom < enemyBox.Bottom)
         {
             player.position.Y -= intersection.Height; // up
         }
         else
         {
             player.position.Y += intersection.Height; // down
         }
     }
 }
开发者ID:buttsj,项目名称:CSharpMon,代码行数:30,代码来源:EnemyCollisionResponse.cs


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