// end of neutral region
    //#endregion

    #region Pacifist Protocols
    // checks if there are enough friends to party
    // moves if necessary to the nearest friend
    // socializes
    /// <summary>
    /// Checks if there are enough friends to party then socializes
    /// </summary>
    public void Party()
    {
        #region Get Nearest + Null Check
        Vector2 pos = Checks.AverageGroupPosition();
        #endregion

        // move to
        if (Behaviour.MoveTo(pos, AiData.Speed, AiData.MeleeAttackThreshold))
        {
            // socialize
            if (Behaviour.Socialize())
            {
                // reset action timer
                Wander(10f, 10f);
            }
        }
    }
Exemplo n.º 2
0
    public override void Invoke()
    {
        switch (curr)
        {
        case Behavior.Idle:
            _behave.Idle();
            break;

        case Behavior.MoveTo:
            _behave.MoveTo(targetPos, speed, threshold);
            break;

        case Behavior.MoveAwayFrom:
            _behave.MoveFrom(targetPos, speed, threshold + 1);
            break;

        case Behavior.Feed:
            _behave.Feed(target);
            break;

        case Behavior.Attack:
            _behave.MeleeAttack(targetPos);
            break;

        case Behavior.Ranged:
            _behave.RangedAttack(targetPos, speed);
            break;

        case Behavior.Socialize:
            _behave.Socialize();
            break;

        case Behavior.Custom:
            custom.InvokeBehavior();
            break;
        }
    }