Beispiel #1
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;
        }
    }
    //end of aggro region
    #endregion

    #region Neutral Protocols
    // Lazy()
    // just chill
    /// <summary>
    /// If idle, update awareness and reset timers
    /// </summary>
    public void Lazy()
    {
        #region Get Nearest + Null Checks
        // For now, fun away from your first enemy (SOMA most likely)
        // Vector2 pos = new Vector2(-9.5f, -3.5f);

        /*GameObject creature = Checks.ClosestCreature();
         * Vector2 pos;
         * if (creature != null)
         *  pos = creature.gameObject.transform.position;
         * else
         *  return;
         */
        //pos = new Vector2(-2.5f, -2.5f);

        /*TileNode realPos = Checks.GetNearestNode(pos);
         * Debug.Log("The Tile Node " + realPos.name + " -- found: " + realPos.transform + " (" + realPos.x + ", " + realPos.y + ")");
         * NavTo(realPos);*/
        #endregion
        if (Behaviour.Idle())
        {
            Wander(2f, 2f);
        }
    }