From 5c6c99c707aa3129efcca060f64df143dd915961 Mon Sep 17 00:00:00 2001 From: SMahdiFaghih Date: Thu, 29 Apr 2021 15:59:53 +0430 Subject: [PATCH] fixed multimple bases for minigame bug --- Assets/Scripts/Map/GameManager.cs | 22 ++-------------------- Assets/Scripts/PrefabScripts/AntScript.cs | 3 +-- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Assets/Scripts/Map/GameManager.cs b/Assets/Scripts/Map/GameManager.cs index 8207408..7e25bd9 100644 --- a/Assets/Scripts/Map/GameManager.cs +++ b/Assets/Scripts/Map/GameManager.cs @@ -74,8 +74,6 @@ public void StartGameManager(GameLog gameLog) this.gameLog = gameLog; base1.GetComponent().SetMaxHealth(gameLog.Map.BaseHealth); base2.GetComponent().SetMaxHealth(gameLog.Map.BaseHealth); - base1 = InstansiateCell(base1, 0, 0); - base2 = InstansiateCell(base2, 0, 0); ShowMap(); FindObjectOfType().setMaid(gameLog.Map.cells.Length * width, gameLog.Map.cells[0].Length * haight); MaxTurns = gameLog.Turns.Length; @@ -344,26 +342,10 @@ private void ShowMap() Temps.Add(InstansiateCell(cell_mud, i, j)); break; case 0: - if (base1 == null) - { - base1 = InstansiateCell(base1, i, j); - } - else - { - base1.transform.position = ConvertPosition(i, j); - } - + base1 = InstansiateCell(base1, i, j); break; case 1: - if (base2 == null) - { - base2 = InstansiateCell(base2, i, j); - } - else - { - base2.transform.position = ConvertPosition(i, j); - } - + base2 = InstansiateCell(base2, i, j); break; } } diff --git a/Assets/Scripts/PrefabScripts/AntScript.cs b/Assets/Scripts/PrefabScripts/AntScript.cs index 40aa55b..9a273b5 100644 --- a/Assets/Scripts/PrefabScripts/AntScript.cs +++ b/Assets/Scripts/PrefabScripts/AntScript.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using Unity.Mathematics; using UnityEngine; using UnityEngine.UI; @@ -97,7 +96,7 @@ public IEnumerator Go(int x, int y, int health, int recource, float time, int nu SetResource(recource); SetHealth(health); temp = GameManager.Instance.ConvertPosition(x, y) + handleMulty(numbers, n, GameManager.Instance.width); - if (math.abs(old_x - x) > 1 || math.abs(old_y - y) > 1) + if (Math.Abs(old_x - x) > 1 || Math.Abs(old_y - y) > 1) { //minor mode mainAnimator.Play("Idle");