void Retrieval() { Square_Info si_; si_ = now_pos.GetComponent <Square_Info>(); si_.Decision(); GameObject[] nears_ = si_.GetNear(); foreach (GameObject n in nears_) { if (n.GetComponent <Square_Info>().GetChara() != null) { if (n.GetComponent <Square_Info>().GetChara().tag == "Player") { continue; } } Square_Info n_si_ = n.GetComponent <Square_Info>(); if (cost - n_si_.GetCost() >= 0 && n_si_.CanSetCost(cost, now_pos) && first_cost >= n_si_.GetCost()) { n_si_.Decision(); Retrieval(n, cost); } } }
public void Retrieval() // 10/27 publicに変更 { FindObjectOfType <RayBox>().move_ = true; Square_Info si_; si_ = now_pos.GetComponent <Square_Info>(); si_.Decision(); GameObject[] nears_ = si_.GetNear(); foreach (GameObject n in nears_) { if (n.GetComponent <Square_Info>().GetChara() != null) { if (n.GetComponent <Square_Info>().GetChara().tag == "Enemy") { continue; } } Square_Info n_si_ = n.GetComponent <Square_Info>(); if (cost - n_si_.GetCost() >= 0 && n_si_.CanSetCost(cost, now_pos)) { n_si_.Decision(); Retrieval(n, cost); } } rayBox.GetComponent <RayBox>().SetMovePlayer(gameObject); }
// Update is called once per frame void Update() { // 選択したマスが移動可能なマスであれば移動を開始する if ((Input.GetKeyDown(KeyCode.Return) || Input.GetButtonDown("O") || Input.GetKeyDown(KeyCode.Space)) && !moving_) { if (FindObjectOfType <BattleFlowTest>().state_ != State_.move_mode || FindObjectOfType <BattleFlowTest>()._nowChooseChar != gameObject) { return; // 10/31 追加 } FindObjectOfType <RayBox>().move_ = false; Ray ray = new Ray(rayBox.transform.position, -rayBox.transform.up);// 10/27 追加 RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit, 1000.0f)) { if (hit.transform.tag == "Floor") { Square_Info a = hit.transform.GetComponent <Square_Info>(); if (a.IsDecision()) { Search(hit.transform.gameObject); GameObject[] obj = GameObject.FindGameObjectsWithTag("Floor"); foreach (GameObject g in obj) { g.GetComponent <Square_Info>().DecisionEnd(); } } } else if (hit.transform.tag == "Player") { GameObject[] obj = GameObject.FindGameObjectsWithTag("Floor"); foreach (GameObject g in obj) { g.GetComponent <Square_Info>().DecisionEnd(); } FindObjectOfType <BattleFlowTest>().moveEnd(); } } } // 移動 if (moving_) { Move(); } }
void Retrieval(GameObject near, int cost_) { Square_Info si_; si_ = near.GetComponent <Square_Info>(); GameObject[] nears_ = si_.GetNear(); cost_ -= si_.GetCost(); foreach (GameObject n in nears_) { Square_Info n_si_ = n.GetComponent <Square_Info>(); if (cost_ - n_si_.GetCost() >= 0 && n_si_.CanSetCost(cost_, near)) { n_si_.Decision(); Retrieval(n, cost_); } } }
public void Retrieval() { Square_Info si_; si_ = now_pos.GetComponent <Square_Info>(); si_.Decision(); GameObject[] nears_ = si_.GetNear(); foreach (GameObject n in nears_) { Square_Info n_si_ = n.GetComponent <Square_Info>(); if (cost - n_si_.GetCost() >= 0 && n_si_.CanSetCost(cost, now_pos)) { n_si_.Decision(); Retrieval(n, cost); } } }
public void RangeDisplay() { int move_cost = first_cost; Square_Info si_; si_ = now_pos.GetComponent <Square_Info>(); si_.SetNowPosCost(move_cost); si_.Decision(); GameObject[] nears_ = si_.GetNear(); foreach (GameObject n in nears_) { Square_Info n_si_ = n.GetComponent <Square_Info>(); if (move_cost - n_si_.GetCost() >= 0 && n_si_.CanSetCost(move_cost, now_pos)) { n_si_.Decision(); RangeSearch(n, move_cost + attak_range); } } }
void RangeSearch() { int move_cost = first_cost; Square_Info si_; si_ = now_pos.GetComponent <Square_Info>(); si_.SetNowPosCost(move_cost); si_.Decision(); GameObject[] nears_ = si_.GetNear(); foreach (GameObject n in nears_) { if (n.GetComponent <Square_Info>().GetChara() != null) { if (n.GetComponent <Square_Info>().GetChara().tag == "Player") { player_in_range = true; target_square = now_pos; in_range_player = n.GetComponent <Square_Info>().GetChara(); break; } } } if (!player_in_range) { foreach (GameObject n in nears_) { Square_Info n_si_ = n.GetComponent <Square_Info>(); if (move_cost - n_si_.GetCost() >= 0 && n_si_.CanSetCost(move_cost, now_pos)) { n_si_.Decision(); RangeSearch(n, move_cost + attak_range); } } PlayerSearch(); } }
void Retrieval(GameObject near, int cost_) { Square_Info si_; si_ = near.GetComponent <Square_Info>(); GameObject[] nears_ = si_.GetNear(); cost_ -= si_.GetCost(); foreach (GameObject n in nears_) { if (n.GetComponent <Square_Info>().GetChara() != null) { if (n.GetComponent <Square_Info>().GetChara().tag == "Enemy") { continue; } } Square_Info n_si_ = n.GetComponent <Square_Info>(); if (cost_ - n_si_.GetCost() >= 0 && n_si_.CanSetCost(cost_, near)) { n_si_.Decision(); Retrieval(n, cost_); } } }