Exemple #1
0
    void SetDefaultAction(ActionController.mAction _previousFinished_action)
    {
        Debug.Log(_previousFinished_action);
        //if target in rnage => chase it
        if (GetTargetInDetectRange())
        {
            move_goal.position = detect_result[0].gameObject.transform.position;

            actionController.AddAction(move_act);
        }
        else
        {
            //walk randomly (set move goal to random point) or Idle
            int rand = Random.Range(0, 100);
            if (rand < 50)
            {
                actionController.AddAction(Idle_act);
                return;
            }

            //TODO: 改用方向?
            Vector2 _goal = new Vector2(
                Random.Range(-random_move_radious, random_move_radious),
                Random.Range(-random_move_radious, random_move_radious));
            move_goal.position = _goal + (Vector2)transform.position;

            actionController.AddAction(move_act);
        }
    }
    //------------TEST----------------
    private async void Start()
    {
        await Task.Yield();

        Debug.Log("staty開始");

        _act_idle = new ActionController.mAction(
            Idle,
            "Idle",
            0,
            false,
            1,
            10
            );
        _act_walk = new ActionController.mAction(
            Move,
            "Move",
            1,
            false,
            1,
            10
            );

        _act_dash = new ActionController.mAction(
            Dash,
            "Dash",
            5,
            true,
            1,
            10
            );



        Debug.Log("start結束");
    }