void Start() { Axis = GameObject.Find("Axis"); AxisRB = Axis.GetComponent <Rigidbody2D>(); Plank = GameObject.Find("Seg6"); PlankRB = Plank.GetComponent <Rigidbody2D>(); defaultRotation = PlankRB.rotation; }
private void OnTriggerEnter(Collider other) { //if(other.GetComponent<RobotController>() && !animator.GetCurrentAnimatorClipInfo(0)[0].clip.Equals(push)) { print(animator.GetCurrentAnimatorClipInfoCount(0)); if (other.GetComponent <RobotController>() && (animator.GetCurrentAnimatorClipInfoCount(0) == 0) && spawn) { Plank p = SpawnPlank(); Rigidbody rb = p.GetComponent <Rigidbody>(); rb.isKinematic = false; rb.useGravity = true; // spawn = false; animator.SetTrigger("push plank"); } }
private void OnTriggerEnter(Collider other) { // print("on trigger enter"); if (p) { pickedUp = p.pickedUp; } if (!pickedUp && other.TryGetComponent <Plank>(out p) && !p.placed) { // print("added velcro"); pickedUp = true; p.pickedUp = true; p.transform.parent = transform; p.GetComponent <Rigidbody>().isKinematic = true; } }
public void GameStart() { gameControllerScript.gameStart = true; CatSelect.SetActive(false); PigSelect.SetActive(false); BearSelect.SetActive(false); PandaSelect.SetActive(false); background.SetActive(false); selectChar.SetActive(false); Logo.SetActive(false); scoreScript.score = 0; Plank.GetComponent <Rigidbody2D>().freezeRotation = false; projectileScriptv2.launched = true; GameStarter.SetActive(false); }
private void OnTriggerEnter(Collider other) { if (!attatched) { print("on trigger enter"); PlankVelcro plankVelcro; if (other.TryGetComponent <PlankVelcro>(out plankVelcro)) { attatched = true; Plank p = plankVelcro.transform.parent.GetComponent <Plank>(); print(p); p.transform.parent = null; p.transform.name = "testing 111111111111111111111111"; p.pickedUp = false; p.placed = true; print("is kinimatic off"); p.GetComponent <Rigidbody>().isKinematic = false; print(p.transform.parent); } } }
public void Replay() { CatSelect.SetActive(true); PigSelect.SetActive(true); BearSelect.SetActive(true); PandaSelect.SetActive(true); background.SetActive(true); selectChar.SetActive(true); Logo.SetActive(true); scoreText2.enabled = false; gameControllerScript.timeLeft = 60; ReplayButton.SetActive(false); Plank.GetComponent <Rigidbody2D>().rotation = 0f; Plank.GetComponent <Rigidbody2D>().freezeRotation = true; Plank.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); /*gameControllerScript.gameStart = true; * gameControllerScript.timeLeft = 10; * gameControllerScript * ReplayButton.SetActive(false); */ }