Skip to content

Commit

Permalink
fixed multimple bases for minigame bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SMahdiFaghih committed Apr 29, 2021
1 parent 5859e22 commit 5c6c99c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
22 changes: 2 additions & 20 deletions Assets/Scripts/Map/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public void StartGameManager(GameLog gameLog)
this.gameLog = gameLog;
base1.GetComponent<BaseScript>().SetMaxHealth(gameLog.Map.BaseHealth);
base2.GetComponent<BaseScript>().SetMaxHealth(gameLog.Map.BaseHealth);
base1 = InstansiateCell(base1, 0, 0);
base2 = InstansiateCell(base2, 0, 0);
ShowMap();
FindObjectOfType<MoveCamera>().setMaid(gameLog.Map.cells.Length * width, gameLog.Map.cells[0].Length * haight);
MaxTurns = gameLog.Turns.Length;
Expand Down Expand Up @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions Assets/Scripts/PrefabScripts/AntScript.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.UI;

Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 5c6c99c

Please sign in to comment.