示例#1
0
    public void UseCurrentPower()
    {
        if (!_isSwimming)
        {
            Power curPower = null;

            if (currentPower < powers.Count)
            {
                curPower = powers[currentPower];
            }

            if (curPower != null)
            {
                if (vitae - curPower.CostVitae > 0.25f)
                {
                    curPower.Attack();
                    AdjustVitae(-curPower.CostVitae, curPower.audioFx);
                }
                else
                {
                    UIManager.Notify("You can't use all your blood");
                }
            }
        }
        else
        {
            UIManager.Notify("You can't use your powers in water");
        }
    }
示例#2
0
    // Directional attack
    protected bool AttemptAttack(int deltaX, int deltaY)
    {
        Organism enemy = GameManager.Level.GetOrganism(position.x + deltaX, position.y + deltaY);

        if (enemy != null && IsVisible(enemy))
        {
            return(power.Attack(this, enemy));
        }

        return(false);
    }