コード例 #1
0
ファイル: AIBehavior.cs プロジェクト: hide-my-github/Float2.0
    //FPS
    void FixedUpdate()
    {
        nextFire -= Time.deltaTime;

        if (nextFire <= 0.0f)
        {
            nextFire = 0.5f;
            shoot();
        }
        //Debug.Log ("before Astarpath");
        //Astar ();
        //Debug.Log ("after Astarpath");

        /*
         * if (path != null && path.Count != 0) {
         *      string next_move = path [0];
         *      path.RemoveAt (0);
         *      Debug.Log ("A: " + next_move);
         *      State position = new State (this.gameObject.transform.position);
         *      apply_move (next_move, position);
         * } else {*/
//		Debug.Log ("B");
        //Debug.Log ("path: " + path[0]);
        State initial = new State(this.gameObject.transform.position);

        path = astar.Aalgorithm(initial);

        if (path.Count > 0)
        {
            apply_move(path [0]);
            //Debug.Log ("ACTION: " + path [0]);
            path.RemoveAt(0);
        }

        /*for (int i = 0; i < path.Count; i++) {
         *      apply_move (path[i], initial);
         * }*/
    }