Player Trap ID fix
This commit is contained in:
@@ -174,12 +174,16 @@ public class NoPlayablePlayer : Player
|
|||||||
if (currentField.placedItem != null)
|
if (currentField.placedItem != null)
|
||||||
{
|
{
|
||||||
Trap t = currentField.placedItem.GetComponent<Trap>();
|
Trap t = currentField.placedItem.GetComponent<Trap>();
|
||||||
|
|
||||||
|
if(t.target.index != index)
|
||||||
|
{
|
||||||
AddCoins(-3);
|
AddCoins(-3);
|
||||||
t.target.AddCoins(3);
|
t.target.AddCoins(3);
|
||||||
currentField.placedItem = null;
|
currentField.placedItem = null;
|
||||||
Destroy(t.gameObject);
|
Destroy(t.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Vector3 currentRotation = Quaternion.ToEulerAngles(transform.rotation);
|
Vector3 currentRotation = Quaternion.ToEulerAngles(transform.rotation);
|
||||||
currentRotation.y = -34;
|
currentRotation.y = -34;
|
||||||
|
|||||||
@@ -177,6 +177,9 @@ public class PlayablePlayer : Player
|
|||||||
if (currentField.placedItem != null)
|
if (currentField.placedItem != null)
|
||||||
{
|
{
|
||||||
Trap t = currentField.placedItem.GetComponent<Trap>();
|
Trap t = currentField.placedItem.GetComponent<Trap>();
|
||||||
|
|
||||||
|
if(t.target.index != index)
|
||||||
|
{
|
||||||
AddCoins(-3);
|
AddCoins(-3);
|
||||||
Debug.Log(t.name);
|
Debug.Log(t.name);
|
||||||
t.target.AddCoins(3);
|
t.target.AddCoins(3);
|
||||||
@@ -184,6 +187,7 @@ public class PlayablePlayer : Player
|
|||||||
Destroy(t.gameObject);
|
Destroy(t.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Vector3 currentRotation = Quaternion.ToEulerAngles(transform.rotation);
|
Vector3 currentRotation = Quaternion.ToEulerAngles(transform.rotation);
|
||||||
currentRotation.y = -34;
|
currentRotation.y = -34;
|
||||||
transform.rotation = Quaternion.Euler(currentRotation);
|
transform.rotation = Quaternion.Euler(currentRotation);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public abstract class Player : MonoBehaviour
|
|||||||
protected Field currentField;
|
protected Field currentField;
|
||||||
|
|
||||||
protected Vector3 cameraOffset = new Vector3(-2.81f, 8.13f, 5.6f);
|
protected Vector3 cameraOffset = new Vector3(-2.81f, 8.13f, 5.6f);
|
||||||
|
//players ID
|
||||||
public int index;
|
public int index;
|
||||||
public int coins = 0;
|
public int coins = 0;
|
||||||
public int stars = 0;
|
public int stars = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user