public void restart() { BallRespawn.respawnBall(); ps.PlaySim(); panel.alpha = 0; panel.blocksRaycasts = false; GameObject.Find("UIManager").GetComponent <CollectManager> ().tempCollected.Clear(); GameObject.Find("Placing").GetComponent <ElementPlacing> ().canPlace = true; }
void Start() { Player = FindObjectOfType <PlayerController> (); _positionToPlayer = transform.position - Player.transform.position; _hitSound = GetComponent <AudioSource> (); _sceneController = FindObjectOfType <SceneController> (); _respawn = FindObjectOfType <BallRespawn> (); Speed += PlayerPrefs.GetInt("Level") / 3; }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Unpicke") { //Als een 'throwable' item dit raakt, zal die despawnen. vanish = true; ballRespawn = other.gameObject.GetComponent <BallRespawn>(); ballRespawn.vanishing = true; ballRespawn.vanishingSpeed = vanishingSpeed; } }
void Start() { //Sla de MeshRenderers van de linker -en rechterhand op in variabelen, voor later gebruik. mr_left = leftHand.GetComponent <MeshRenderer>(); mr_right = rightHand.GetComponent <MeshRenderer>(); //Pak de sprite die boven de lege pingpongBat staat (deze moet later uit, vandaar). explSprite = GameObject.Find("ExplanationSprite"); //Sla het script in een variabel op om die later te kunnen gebruiken. ballRespawn = GameObject.FindGameObjectWithTag("PingPongBall").GetComponent <BallRespawn>(); }
public void PlaySim() { Positioning.hideButtons(); Positioning.isPositioning = false; BlockHover.hideGrid(); BlockHover.hideRampGrid(); foreach (GameObject child in GameObject.FindGameObjectsWithTag("Spawned Objects")) { foreach (MonoBehaviour script in child.GetComponents <MonoBehaviour>()) { if (!script.name.Equals("ElementPlacing")) { if (!isSimActive) { script.enabled = true; } else { script.enabled = false; } } } } if (!isSimActive) { GameObject.Find("PlaySimButton").GetComponent <Image> ().sprite = GameObject.Find("StopSprite").GetComponent <SpriteRenderer> ().sprite; //ball.transform.position = new Vector3 (2, 0.21f, -3.07f); BallRespawn.respawnBall(); ball.GetComponent <Rigidbody> ().isKinematic = false; ball.GetComponent <Rigidbody> ().detectCollisions = true; } else { GameObject.Find("PlaySimButton").GetComponent <Image> ().sprite = oldSprite; BallRespawn.respawnBall(); //ball.transform.position = new Vector3 (2, 0.21f, -3.07f); ball.GetComponent <Rigidbody> ().isKinematic = true; ball.GetComponent <Rigidbody> ().detectCollisions = false; ball.GetComponent <Rigidbody> ().velocity = Vector2.zero; ball.GetComponent <Rigidbody> ().angularVelocity = Vector2.zero; } isSimActive = !isSimActive; if (isSimActive) { wt.OnMouseDown(); } }
//public GameObject ballcontroll; // Use this for initialization void Start() { theText = GetComponent <TextMeshProUGUI>(); scoremanager = GetComponent <ScoreManager>(); Timecounter = startingtime; BallControl = GetComponent <BallControl>(); BallRespawn = GetComponent <BallRespawn>(); }
void Start() { rb = GetComponent <Rigidbody>(); ballRespawn = GetComponent <BallRespawn>(); playerTarget = GameObject.Find("PlayerTarget"); enemyTarget = GameObject.Find("EnemyTarget"); smashTarget = GameObject.Find("SmashTarget"); grabPongBat = GameObject.Find("GetBat-Col").GetComponent <GrabPongBat>(); pongscore = GameObject.Find("MainGameLogic").GetComponent <PongScore>(); pongEnemy = GameObject.Find("EnemyBat").GetComponent <PongEnemy>(); startPos = gameObject.transform.position; }
void Switches() { RaycastHit hit; Ray screenray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(screenray, out hit, switchRange)) { BallRespawn ball = hit.transform.GetComponent <BallRespawn>(); Debug.Log("Not working"); if (ball != null) { Debug.Log("isWorking"); ball.Respawn(); } } }
static public void respawnBall() { GameObject ball = GameObject.Find("Ball"); BallRespawn br = ball.GetComponent <BallRespawn> (); ball.GetComponent <Transform>().position = new Vector3(br.respawnX, br.respawnY, br.respawnZ); ball.GetComponent <Rigidbody>().velocity = Vector3.zero; ball.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; CollectManager cm = GameObject.Find("UIManager").GetComponent <CollectManager> (); GameObject collectibles = GameObject.Find("Collectibles"); foreach (Transform child in collectibles.transform) { child.gameObject.GetComponent <BoxCollider> ().enabled = true; child.gameObject.GetComponent <MeshRenderer> ().enabled = true; //collectibles.transform.GetChild(index).GetComponent<BoxCollider> ().enabled = true; //collectibles.transform.GetChild(index).GetComponent<MeshRenderer> ().enabled = true; } cm.tempCollected.Clear(); GameObject.Find("Placing").GetComponent <ElementPlacing> ().canPlace = true; }
void Start() { ballRespawn = SpawnScript.GetComponent <BallRespawn>(); gameController = Game_Controller.GetComponent <GameController>(); }
// Use this for initialization void Start() { spawnScriptNorth = SpawnPointNorth.GetComponent <BallRespawn>(); spawnScriptSouth = SpawnPointSouth.GetComponent <BallRespawn>(); }