Ejemplo n.º 1
0
    void ClickTileOrUI(bool left)
    {
        var accepter = FindInputAccepter();

        if (accepter == null)
        {
            if (unitCursor.HasFoundTile())
            {
                AbstractAttack attack = null;
                if (left)
                {
                    attack = new RoundAttack(unitCursor.GetSpawnPoint(false));
                }
                else
                {
                    attack = new StraightAttack(unitCursor.GetSpawnPoint(false));
                }

                if (attack.GetComsumption() <= GameDataManager.Instance.UnitPower)
                {
                    mainCharacter.AnimateAttack();
                    attack.Animate(unitCursor.GetSpawnPoint(false));
                    ObjectManager.Instance.WaveManager.enemies
                    .Where(e => attack.IsInRange(e.transform.position))
                    .ToList()
                    .ForEach(e => e.Damaged(attack.GetDamage()));
                    GameDataManager.Instance.UnitPower -= attack.GetComsumption();
                }
            }
        }
        else
        {
            accepter.Execute();
        }
    }
Ejemplo n.º 2
0
    public AbstractAttack CreateAttack(Vector3 pos, AttackType type)
    {
        AbstractAttack attack = null;

        switch (type)
        {
        case AttackType.Round:
            attack = new RoundAttack(pos);
            break;

        case AttackType.Straight:
            attack = new StraightAttack(pos);
            break;
        }
        return(attack);
    }