void OnMouseDown() { if (shotFiredRecently) { return; } //The player has pressed the mouse button while over Slingshot throwing.SetActive(true); standing.SetActive(false); aimingMode = true; //Instantiate a projectile GameObject prefabToUse = ShowProjectilesLeft.GetClosestPrefab(); if (prefabToUse == null) { showLoseScreen(); } else { projectile = Instantiate(prefabToUse) as GameObject; projectile.tag = "HoldingProjectile"; //Start it at the launchPoint projectile.transform.position = launchPos; //Set it to isKinematic for now projectileRigidbody = projectile.GetComponent <Rigidbody>(); projectileRigidbody.isKinematic = true; ShowProjectilesLeft.GetClosestBall(true); } }
private void OnCollisionEnter(Collision collision) { if (collision.collider.CompareTag("Projectile")) { ShowProjectilesLeft.AddRewardBall(projprefab); GameObject.Find("Flagpole(Clone)").SetActive(false); } }
public static void CallLoseScreen() { print("here"); GameObject prefabToUse = ShowProjectilesLeft.GetClosestPrefab(); print(prefabToUse); if (prefabToUse == null) { print("started invoking"); S.Invoke("showLoseScreen", 1.5f); } }