コード例 #1
0
    /*private void ActionRotate(Vector3 direction)
     * {
     *      RotateAction = AgentActionFactory.Create(AgentActionFactory.E_Type.Rotate) as AgentActionRotate;
     *      RotateAction.Direction = direction;
     *      Owner.BlackBoard.AddAction(RotateAction);
     * }*/

    private void SendAction()
    {
        Action                     = AgentActionFactory.Create(AgentActionFactory.E_Type.E_COMBAT_MOVE) as AgentActioCombatMove;
        Action.MoveType            = E_MoveType.Forward;
        Action.Target              = Owner.BlackBoard.DesiredTarget;
        Action.DistanceToMove      = UnityEngine.Random.Range((Owner.BlackBoard.DistanceToTarget - (Owner.BlackBoard.CombatRange * 0.5f)) * 0.5f, Owner.BlackBoard.DistanceToTarget - (Owner.BlackBoard.CombatRange * 0.5f));
        Action.MinDistanceToTarget = 3;
        Owner.BlackBoard.AddAction(Action);
        //UnityEngine.Debug.Log(this.ToString() + "Send new goto action to pos " + FinalPos.ToString());
    }
コード例 #2
0
    /*private void ActionRotate(Vector3 direction)
     * {
     *      RotateAction = AgentActionFactory.Create(AgentActionFactory.E_Type.Rotate) as AgentActionRotate;
     *      RotateAction.Direction = direction;
     *      Owner.BlackBoard.ActionAdd(RotateAction);
     * }*/

    private void SendAction()
    {
        Action                     = AgentActionFactory.Create(AgentActionFactory.E_Type.E_COMBAT_MOVE) as AgentActioCombatMove;
        Action.MoveType            = E_MoveType.StrafeLeft;
        Action.Target              = Owner.BlackBoard.DesiredTarget;
        Action.MinDistanceToTarget = Owner.BlackBoard.DistanceToTarget * 0.7f;
        Action.DistanceToMove      = UnityEngine.Random.Range(2.0f, 4.0f);;
        Owner.BlackBoard.ActionAdd(Action);

        //UnityEngine.Debug.Log(this.ToString() + "Send new goto action to pos " + FinalPos.ToString());
    }
コード例 #3
0
    /*private void ActionRotate(Vector3 direction)
     * {
     *      RotateAction = AgentActionFactory.Create(AgentActionFactory.E_Type.Rotate) as AgentActionRotate;
     *      RotateAction.Direction = direction;
     *      Owner.BlackBoard.ActionAdd(RotateAction);
     * }*/

    private void SendAction()
    {
        Action                     = AgentActionFactory.Create(AgentActionFactory.E_Type.E_COMBAT_MOVE) as AgentActioCombatMove;
        Action.MoveType            = E_MoveType.Forward;
        Action.MotionType          = E_MotionType.Run;
        Action.Target              = Owner.BlackBoard.DesiredTarget;
        Action.DistanceToMove      = Owner.BlackBoard.DistanceToTarget - (Owner.BlackBoard.CombatRange * 0.8f); // a little bit ahead of range
        Action.MinDistanceToTarget = 3;
        Owner.BlackBoard.ActionAdd(Action);

        //UnityEngine.Debug.Log(this.ToString() + "Send new goto action to pos " + FinalPos.ToString());
    }
コード例 #4
0
ファイル: AnimStateCombatMove.cs プロジェクト: cuongdv/wushi2
    override public void OnDeactivate()
    {
        if (Action != null)
        {
            Action.SetSuccess();
            Action = null;
        }

        Owner.BlackBoard.Speed = 0;

        base.OnDeactivate();

        // Time.timeScale = 1;
    }
コード例 #5
0
ファイル: AnimStateCombatMove.cs プロジェクト: cuongdv/wushi2
    protected override void Initialize(AgentAction action)
    {
        base.Initialize(action);

        Action = action as AgentActioCombatMove;

        // Debug.Log(Action.MoveType + " Distance to move " + Action.DistanceToMove);

        UpdateFinalRotation();
        //UpdateFinalPosition();

        Owner.BlackBoard.MotionType = E_MotionType.Walk;

        RotationProgress = 0;
        MovedDistance    = 0;

        Owner.BlackBoard.MoveType = E_MoveType.None;

        UpdateMoveType();
    }
コード例 #6
0
    static public AgentAction Create(E_Type type)
    {
        int index = (int)type;

        AgentAction a;

        if (m_UnusedActions[index].Count > 0)
        {
            a = m_UnusedActions[index].Dequeue();
        }
        else
        {
            switch (type)
            {
            case E_Type.E_IDLE:
                a = new AgentActionIdle();
                break;

            case E_Type.E_MOVE:
                a = new AgentActionMove();
                break;

            case E_Type.E_GOTO:
                a = new AgentActionGoTo();
                break;

            case E_Type.E_COMBAT_MOVE:
                a = new AgentActioCombatMove();
                break;

            case E_Type.E_ATTACK:
                a = new AgentActionAttack();
                break;

            case E_Type.E_ATTACK_ROLL:
                a = new AgentActionAttackRoll();
                break;

            case E_Type.E_ATTACK_WHIRL:
                a = new AgentActionAttackWhirl();
                break;

            case E_Type.E_INJURY:
                a = new AgentActionInjury();
                break;

            case E_Type.E_DAMAGE_BLOCKED:
                a = new AgentActionDamageBlocked();
                break;

            case E_Type.E_BLOCK:
                a = new AgentActionBlock();
                break;

            case E_Type.E_ROLL:
                a = new AgentActionRoll();
                break;

            case E_Type.E_INCOMMING_ATTACK:
                a = new AgentActionIncommingAttack();
                break;

            case E_Type.E_WEAPON_SHOW:
                a = new AgentActionWeaponShow();
                break;

            case E_Type.Rotate:
                a = new AgentActionRotate();
                break;

            case E_Type.E_USE_LEVER:
                a = new AgentActionUseLever();
                break;

            case E_Type.E_PLAY_ANIM:
                a = new AgentActionPlayAnim();
                break;

            case E_Type.E_PLAY_IDLE_ANIM:
                a = new AgentActionPlayIdleAnim();
                break;

            case E_Type.E_DEATH:
                a = new AgentActionDeath();
                break;

            case E_Type.E_KNOCKDOWN:
                a = new AgentActionKnockdown();
                break;

            case E_Type.Teleport:
                a = new AgentActionTeleport();
                break;

            default:
                Debug.LogError("no AgentAction to create");
                return(null);
            }
        }
        a.Reset();
        a.SetActive();

        // DEBUG !!!!!!
        m_ActionsInAction.Add(a);
        return(a);
    }