Exemplo n.º 1
0
    // Update is called once per frame
    public void Update(float deltaTime)
    {
        if (!isNeutral)
        {
            foreach (var b in bases)
            {
                b.Update(deltaTime);
            }
            foreach (var unit in units)
            {
                unit.Update(deltaTime);
            }

            Dictionary <BasePiece, int> attackedBases = BehaviorUtility.AttackedBases(this, GameManager.manager.GetOpponents(this));

            foreach (int value in attackedBases.Values)
            {
                Debug.Log("Being attacked by " + value + " units!");
            }
        }

        if (!isHuman && !isNeutral)
        {
            behavior.Update();
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    public void Update()
    {
        ticksSinceLastUpdate++;
        if (ticksSinceLastUpdate > 10)
        {
            ticksSinceLastUpdate = 0;

            if (player.ReadUnits().Count <= 0)
            {
                return;
            }

            ReassignOrphanUnits();

            Dictionary <BasePiece, int> damagedBases  = BehaviorUtility.DamagedBases(player);
            Dictionary <BasePiece, int> attackedBases = BehaviorUtility.AttackedBases(player, GameManager.manager.GetOpponents(player));

            if (DetermineRepair(damagedBases, attackedBases))
            {
                return;
            }

            if (DetermineDefense(attackedBases))
            {
                return;
            }

            if (DetermineAttack())
            {
                return;
            }

            if (DetermineUpgrade())
            {
                return;
            }
        }
    }