void CmdAttack()
    {
        int cnt = 0;
        List <GameObject> colGameObjects;

        colGameObjects = CC_simpleAttack.GetCollidingObjects();
        RpcTest(colGameObjects.Count);
        foreach (var obj in colGameObjects)
        {
            if (obj == null)
            {
                continue;
            }
            var HP = obj.GetComponent <NetHP>();
            if (HP)
            {
                bot = obj.GetComponent <AI_stats>();
                var botlv = bot == null ? 0 : bot.bot_lvl;
                HP.TakeDamage(AttackPower);
                if (obj == null && obj.tag == "Player")
                {
                    playerstats.kills_count++;

                    playerstats.nutrients += 30;
                }
                else if (obj == null && obj.tag == "Bot")
                {
                    bot = obj.GetComponent <AI_stats>();
                    playerstats.creeps_count++;
                    playerstats.nutrients += 15 * bot.bot_lvl;
                }
            }
        }
    }
    void CmdAttack()
    {
        int cnt = 0;
        List <GameObject> colGameObjects;

        colGameObjects = CC_simpleAttack.GetCollidingObjects();
        RpcTest(colGameObjects.Count);
        foreach (var obj in colGameObjects)
        {
            var HP = obj.GetComponent <HealthPoints>();
            if (HP)
            {
                print("lol");
                HP.TakeDamage();
                if (obj == null && obj.tag == "Player")
                {
                    playerstats.kills_count++;

                    playerstats.nutrients += 30;
                }
                else if (obj == null && obj.tag == "Bot")
                {
                    bot = obj.GetComponent <AI_stats>();
                    playerstats.creeps_count++;
                    playerstats.nutrients += 15 * bot.bot_lvl;
                }
            }
        }
    }
示例#3
0
 void Start()
 {
     anim  = GetComponentInChildren <Animation>();
     bot   = gameObject.GetComponentInChildren <Player_detect>();
     stats = gameObject.GetComponent <AI_stats>();
 }
 void Start()
 {
     bot    = gameObject.GetComponentInChildren <Player_detect>();
     stats  = gameObject.GetComponent <AI_stats>();
     bot_hp = gameObject.GetComponent <HealthPoints>();
 }