Beispiel #1
0
    public bool MovePair(AIResponseManager responseManager)
    {
        Debug.Log("-----MOVE PAIR----");
        if (responseManager.Tokens < 2)
        {
            return(false);
        }

        bool temp = true;

        if (creatures[0] != null)
        {
            Debug.Log("creature 1: " + creatures[0]);
            if (!responseManager.Move(creatures[0]))
            {
                temp = false;
            }
        }

        if (creatures[1] != null)
        {
            Debug.Log("creature 2: " + creatures[1]);
            if (!responseManager.Move(creatures[1]))
            {
                temp = false;
            }
        }
        return(temp);
    }
Beispiel #2
0
    public bool AttackAsPair(AIResponseManager responseManager)
    {
        Debug.Log("------ATTACK PAIR----");
        if (creatures[0] == null && creatures[1] == null)
        {
            return(false);
        }

        bool validAttack = false;

        if (creatures[0] != null)
        {
            if (!responseManager.Attack(creatures[0], 1))
            {
                responseManager.Move(creatures[0]);
            }
            else
            {
                validAttack = true;
            }
        }
        if (creatures[1] != null)
        {
            if (!responseManager.Attack(creatures[1], 1))
            {
                responseManager.Move(creatures[1]);
            }
            else
            {
                validAttack = true;
            }
        }

        return(validAttack);
    }
Beispiel #3
0
 public bool MoveSingle(CreatureBase _creature, AIResponseManager responseManager, int _Range)
 {
     if (responseManager.Move(creatures[1], _Range))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #4
0
    public void SpawnPair(AIResponseManager responseManager)
    {
        bool success   = false;
        int  _bunnies  = 0;
        int  _unicorns = 0;

        //---before spawning pair...get amount of bunnies and unicorns in lane to spawn...if more bunnies, start with unicorn..or two uniconrs?----
        List <CreatureBase> _enemies = TournamentManager._instance.lanes[_Lane - 1].GetEnemiesInLane(owner);

        if (_enemies != null)
        {
            foreach (CreatureBase creature in _enemies)
            {
                if (creature.CreatureType == Spawnable.Bunny)
                {
                    _bunnies++;
                }
                else
                {
                    _unicorns++;
                }
            }
        }


        Debug.Log("----SpawnPair--------");

        if (spawnProg == 0)
        {
            if (_unicorns < _bunnies)
            {
                success = responseManager.Spawn(pairTypes[1], _Lane);
            }
            else
            {
                success = responseManager.Spawn(pairTypes[0], _Lane);
            }
        }

        if (spawnProg == 1)
        {
            creatures[0] = TournamentManager._instance.lanes[_Lane - 1].GetFirstLaneNode(owner).activeCreature;
            if (creatures[0] != null)
            {
                success = responseManager.Move(creatures[0]);
            }
        }

        if (spawnProg == 2)
        {
            if (_unicorns < _bunnies)
            {
                success = responseManager.Spawn(pairTypes[0], _Lane);
            }
            else
            {
                success = responseManager.Spawn(pairTypes[1], _Lane);
            }
        }

        if (spawnProg == 3)
        {
            creatures[1] = TournamentManager._instance.lanes[_Lane - 1].GetFirstLaneNode(owner).activeCreature;
            success      = true;
        }

        if (spawnProg == 4)
        {
            if (creatures[0] == null || creatures[0].isDead)
            {
                spawnProg = 0;
                SpawnPair(responseManager);
            }
            if (creatures[1] == null || creatures[1].isDead)
            {
                spawnProg = 1;
                SpawnPair(responseManager);
            }
        }

        if (success)
        {
            spawnProg++;
        }
    }