Why isn't the if statements getting read when the value of play.x is definitely 1 or -1?
Any help would be great thanks if there is anything else you need to know I'll do my best to explain it.
public class WhyDosntThisWork : MonoBehaviour
{
public bool North = false;
public bool South = false;
public bool West = false;
public bool East = false;
public bool jimmy = false;
public float x = 0;
public float y = 0;
public bool IsRotating = false;
public Vector3 Player;
public float if0trueifnotfalse = 0;
void Start()
{
//Player = transform.up;// tryed here aswell still no work
}
void Update()
{
Player = transform.up;
y = Input.GetAxisRaw("Vertical");// press arrowkey
x = Input.GetAxisRaw("Horizontal");// press arrowkey
print(" y = " + y);
print(" x = " + x);
if (y == 0)
{
WereAreWeLooking();// run function should work???
print("we are Running the Script");
}
if (y > 0)
{
print("We Presed up player.x is now 1");
transform.eulerAngles = new Vector3(0,0,-90); // this changes player.x from -1 to 1
}
if (y < 0)
{
print("We Presed down player.x is now -1");
// WereAreWeLooking();
transform.eulerAngles = new Vector3(0,0,90); //this changes player.x from 1 to -1
}
}
void WereAreWeLooking()
{
print("HI we are checking for bools Player.x IS " + Player.x + " so why dont we change the bool");
if (Player.x == -1)// this never runs even tho play.x is -1
{
print("We Are GoingUp");
North = true;
South = false;
East = false;
West = false;
}
else if (Player.x == 1)
{
print("We Are GoingDown");
South = true;
North = false;
East = false;
West = false;
}
else if (Player.z == 1)
{
print("We Are going East");
East = true;
South = false;
North = false;
West = false;
}
else if (Player.z == -1)
{
print("We Aregoing west");
West = true;
East = false;
South = false;
North = false;
}
print("Thanks Checking done");
jimmy = true;
if (if0trueifnotfalse == 1)// this works if i change the value in the inspector
{
jimmy = false;
print("jimmy is 1");
}
}
}