Ejemplo n.º 1
0
    void Start()
    {
        player        = Player_Manager.Instance.player_script;
        key_observer  = Game.Instance.key_observer;
        enemy_action  = new Enemy_Action();
        player_status = Player_Manager.Instance.player_status;
        map_layer     = Dungeon_Manager.Instance.map_layer_2D;

        player.player_mode = ePlayer_Mode.Nomal_Mode;
    }
Ejemplo n.º 2
0
    void Start()
    {
        enemy_counter = 0;
        enemy_status  = new Enemy_Status();

        // 行動決定するクラスの初期化を行う
        enemy_action = new Enemy_Action();
        enemy_action.Initialize();

        enemies    = new List <GameObject>();
        enemy_type = new List <Enemy_Status>();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// エネミーを実際に動かす
    /// </summary>
    /// <param name="point_list">移動先をためているリスト</param>
    public void Move()
    {
        bool       is_update      = true;
        Vector2Int enemy_position = enemy_object.GetComponent <Enemy>().position;
        var        map_layer      = Dungeon_Manager.Instance.map_layer_2D;
        var        enemy          = enemy_object.GetComponent <Enemy>();

        foreach (var p in point_list)
        {
            if (!is_update)
            {
                break;
            }

            // 移動後の座標。部屋のではなく、フロアのものに直して代入
            var after_position = new Vector2Int {
                x = p.x + division_list[now_room_number].Room.Left,
                y = p.y + division_list[now_room_number].Room.Top
            };

            // 床の座標を元のものに戻す
            map_layer.Tile_Swap(enemy_object.transform.position, enemy.Feet);

            // 元の座標を覚える
            Vector2Int before_position = enemy_position;
            if (before_position != after_position)
            {
                is_update = false;
            }
            else
            {
                continue;
            }

            // 移動後の座標に動かす
            enemy_object.transform.position = new Vector3(after_position.x, after_position.y);
            // 本体クラスの座標も動かす
            enemy.Set_Position(after_position);
            Enemy_Action enemy_action = new Enemy_Action();
            Set_Tile(enemy_object.GetComponent <Enemy>().My_Number);
        }

        // ゴールにたどり着いたらリストを破棄
        if (enemy_position == goal_position)
        {
            point_list.Clear();
        }
    }