void FixedUpdate() { //Gets scored boolean value from RightTriggerScript.cs GameObject TriggerRight = GameObject.Find("TriggerRight"); RightTriggerScript rightTriggerScript = TriggerRight.GetComponent <RightTriggerScript>(); rightScored = rightTriggerScript.scoredR; //Gets scored boolean value from LeftTriggerScript.cs GameObject TriggerLeft = GameObject.Find("TriggerLeft"); LeftTriggerScript leftTriggerScript = TriggerLeft.GetComponent <LeftTriggerScript>(); leftScored = leftTriggerScript.scoredL; if (rightScored) { StartCoroutine(SecondWait()); rightScored = false; } if (leftScored) { StartCoroutine(SecondWait2()); leftScored = false; } }
private void Awake() { RD = GetComponent <RightTriggerScript>(); // Not sure if needed RightTrigger = GameObject.Find("TriggerRight"); LeftTrigger = GameObject.Find("TriggerLeft"); RBox = RightTrigger.GetComponent <BoxCollider2D>(); LBox = LeftTrigger.GetComponent <BoxCollider2D>(); }
void FixedUpdate() { //Gets scored boolean value from RightTriggerScript.cs GameObject TriggerRight = GameObject.Find("TriggerRight"); RightTriggerScript rightTriggerScript = TriggerRight.GetComponent <RightTriggerScript>(); rightScored = rightTriggerScript.scoredR; if (rightScored) { anim.SetBool("Goalscore", true); } }
// Update is called once per frame void FixedUpdate() { //Gets scored boolean value from RightTriggerScript.cs GameObject TriggerRight = GameObject.Find("TriggerRight"); RightTriggerScript rightTriggerScript = TriggerRight.GetComponent <RightTriggerScript>(); rightScored = rightTriggerScript.scoredR; if (rightScored) { rightScoreCount = rightScoreCount + 1; rightScored = false; } if (rightScoreCount == 11) { anim.SetBool("FinalGoalScored", true); } }
// Update is called once per frame void FixedUpdate() { //Gets scored boolean value from RightTriggerScript.cs GameObject TriggerRight = GameObject.Find("TriggerRight"); RightTriggerScript rightTriggerScript = TriggerRight.GetComponent <RightTriggerScript>(); rightScored = rightTriggerScript.scoredR; //Gets scored boolean value from LeftTriggerScript.cs GameObject TriggerLeft = GameObject.Find("TriggerLeft"); LeftTriggerScript leftTriggerScript = TriggerLeft.GetComponent <LeftTriggerScript>(); leftScored = leftTriggerScript.scoredL; if (rightScored) { StartCoroutine(SecondWait()); //GetComponent<Rigidbody2D>().velocity = Vector3.zero; //Get Rigidbody and set velocity to (0f, 0f, 0f) //gameObject.transform.position = originalPosP1; //GetComponent<Rigidbody2D>().angularVelocity = 0; //rightScored = false; } if (leftScored) { StartCoroutine(SecondWait()); //GetComponent<Rigidbody2D>().velocity = Vector3.zero; //Get Rigidbody and set velocity to (0f, 0f, 0f) //gameObject.transform.position = originalPosP1; //GetComponent<Rigidbody2D>().angularVelocity = 0; //leftScored = false; } }