Exemplo n.º 1
0
    void Attack()
    {
        if (_facing.IsLeft())
        {
            _target = _shipAttackSpotRight.transform.position;
        }
        else
        {
            _target = _shipAttackSpotLeft.transform.position;
        }


        MoveStraightTowards(_target, _attackSpeed);

        if (transform.position == _target)
        {
            _mode   = MonsterMode.Retreat;
            _target = RetreatPosition();
            if (_facing.IsRight())
            {
                Ship.instance.TakeDamage(_attackPower, 0);
            }
            else
            {
                Ship.instance.TakeDamage(_attackPower, 1);
            }
            _facing.Flip();
        }
    }