// Start is called before the first frame update void Start() { //Script Communication with GameManager and Creating the player start dominoes GMscript = GameManager.GetComponent <GameManagementScript>(); SpawnPoints = GameObject.FindGameObjectsWithTag("PlayerPoints"); foreach (GameObject SP in SpawnPoints) { int i = Random.Range(0, DominoesSprites.Length); GameObject go = new GameObject("PlayerDominoes");; go.transform.SetParent(this.transform); go.transform.position = SP.transform.position; go.transform.localScale = new Vector2(0.6f, 0.6f); SpriteRenderer renderer = go.AddComponent <SpriteRenderer>(); renderer.sprite = DominoesSprites[i]; PlayerDominoes.Add(go); } for (int k = 0; k < PlayerDominoes.Count; k++) { bool CanBePlayed = true; PlayerDominoes[k].name = "PlayerDominoes" + k.ToString(); PlayerDominoes[k].GetComponent <SpriteRenderer>().sortingOrder = 1; PlayerDominoes[k].tag = "Dominoes"; PlayerDominoes[k].AddComponent <BoxCollider2D>(); WhatDominoesCanBePlayed.Add(CanBePlayed); } }
// Start is called before the first frame update void Start() { gameManagement = GameObject.Find("EndOfLevel").GetComponent <GameManagementScript>(); timer = 0; camDone = false; dead = false; }
public void DamagePlayer(float damage) { playerStats.playerHealth -= damage; if (playerStats.playerHealth <= 0) { GameManagementScript.KillPlayer(gameObject); } }
// Start is called before the first frame update void Start() { bottomCheckPoint = gameObject.transform.GetChild(0); checkpointSpriteRenderer = GetComponent <SpriteRenderer>(); endOfLevel = GameObject.Find("EndOfLevel"); gameManager = endOfLevel.GetComponent <GameManagementScript>(); gameManager.checkPoints.Add(this.gameObject); curCheckPoint = gameManager.checkPoints.IndexOf(this.gameObject); }
private void Start() { if (endOfLevel == null) { endOfLevel = GameObject.Find("EndOfLevel"); } if (manager == null) { manager = endOfLevel.GetComponent <GameManagementScript>(); } }
// Start is called before the first frame update void Awake() { DontDestroyOnLoad(gameObject); if (_GameManagement == null) { GameManagementScript._GameManagement = this; _GridManager = new GridManager(GridSize.x, GridSize.y, GridSize.z, Resolution, RenderArea, SimulationArea, GridCenter); } else { Destroy(this); } }
public OVRRecenterManagerScript ovrRecenterManager; // OVR Recenter Management Script object /** * @brief Overloaded Awake Function * * @param * @return void * @pre * @post */ void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } m_dbInterface = new DatabaseInterface(); m_security = new Security(m_dbInterface); }
// Use this for initialization void Start() { gameManagement = GameObject.Find("EndOfLevel").GetComponent <GameManagementScript>(); changeGravityFreeze = 0; changeGravity = false; coyoteTimer = 0; coyoteTimer2 = 0; coyoteGround = false; coyoteGround2 = false; topTimer = 0; topHold = false; player1NearGround = false; player2NearGround = false; player2OnBottom = false; onMoving = false; onSpeed = 0f; onMoving2 = false; onSpeed2 = 0f; inTunnel = false; floatTimer = 0; floatTop = false; Application.targetFrameRate = 60; grounded = true; grounded2 = true; forgiveGround = true; forgiveGround2 = true; topOrBottom = 0; topOrBottom2 = 0; inverted = false; otherScript = otherPlayer.GetComponent <VerticalOther>(); inverted2_2 = false; invertOnCommand = false; width = GetComponent <BoxCollider2D>().bounds.size.x; height = GetComponent <BoxCollider2D>().bounds.size.y; //width2 = otherScript.width; //height2 = otherScript.height; charAnim = GetComponentInChildren <Animator>(); otherCharAnim = otherPlayer.GetComponentInChildren <Animator>(); audioSource = GetComponent <AudioSource>(); moving = false; isSet = false; moving2 = false; isSet2 = false; box = null; hiddenGroundFlag1 = false; hiddenGroundFlag2 = false; }
// Start is called before the first frame update void Start() { textMeshPro = gameObject.GetComponent <TextMeshPro>() ?? gameObject.AddComponent <TextMeshPro>(); textMeshPro.maxVisibleCharacters = 0; running = false; secondString = "This is the second string to Test with heheXD"; bg.GetComponent <SpriteRenderer>().enabled = false; manager = GameObject.Find("EndOfLevel").GetComponent <GameManagementScript>(); if (speechType.ToLower().Equals("bubble")) { type = SpeechEnum.Bubble; } else { type = SpeechEnum.Board; } }
void Start() { managementScene = SceneManager.GetActiveScene(); currentApplicationState = "APPLICATIONSTART"; previousApplicationState = "null"; currentLevelScene = null; if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// Use this for initialization void Start() { gameManagement = GameObject.Find("EndOfLevel").GetComponent <GameManagementScript>(); pushLeft = false; nonPushLeft = false; pushRight = false; nonPushRight = false; touchingMoving = false; movingPush = 0f; onMoveLeft = false; masterScript = player1.GetComponent <VerticalMaster>(); cameraScript = cameraBoi.GetComponent <FollowPlayer>(); unlock = false; width = GetComponent <BoxCollider2D>().bounds.size.x; height = GetComponent <BoxCollider2D>().bounds.size.y; //charAnim = GetComponentInChildren<Animator>(); col = false; distanceToCollision = 0f; extraSpeed = 0f; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { GameManagementScript manager = endOfLevel.GetComponent <GameManagementScript>(); manager.UpdateLevelDataCleared(); manager.UnlockNextLevel(); manager.SaveLevel(); manager.unlock = true; SceneManager.LoadScene("HubWorldMusicTest"); //if (curLevel == 1) //{ // SceneManager.LoadScene("NewGraphics2"); //} //else if (curLevel == 2) //{ // SceneManager.LoadScene("NewGraphics3"); //} //else if (curLevel == 3) //{ // SceneManager.LoadScene("NewGraphics4"); //} //else if (curLevel == 4) //{ // SceneManager.LoadScene("NewGraphics5"); //} //else if (curLevel == 5) //{ // SceneManager.LoadScene("NewGraphics6"); //} //else if (curLevel == 6) //{ // SceneManager.LoadScene("NewGraphics7"); //} //else //{ // SceneManager.LoadScene("End Screen"); //} } }
// Use this for initialization void Start() { //Create an initial velocity //Set private variables of GameManager & GameManagementScript gameM = GameObject.Find("GameManager"); gameMS = gameM.GetComponent <GameManagementScript> (); //Set up randomserve value to either 1 or 0. randomServe = Mathf.Round(Random.value); //Set up audio bounce value bounce = GetComponent <AudioSource> (); //If the score isn't 0 and the Right player has just scored, serve the new ball left, otherwise serve right if (gameMS.totalScore != 0) { if (gameMS.rScore) { GetComponent <Rigidbody2D> ().velocity = Vector2.left * speed; } else { GetComponent <Rigidbody2D> ().velocity = Vector2.right * speed; } //Otherwise if there isn't a score yet, but randomscore has been set to 1 not 0, serve it right, otherwise left. } else { if (randomServe == 1) { GetComponent <Rigidbody2D> ().velocity = Vector2.right * speed; } else { GetComponent <Rigidbody2D> ().velocity = Vector2.left * speed; } } }
private Vector3 offset; //Private variable to store the offset distance between the player and camera // Use this for initialization void Start() { gameManagement = GameObject.Find("EndOfLevel").GetComponent <GameManagementScript>(); horScript = player.GetComponent <HorizontalMovement>(); firstEnd = horScript.firstEnd; onInit = true; startDead = true; deathScript = playBoth.GetComponent <DeathScript>(); firstStopScript = firstStop.GetComponent <cameraEnd>(); secondStopScript = secondStop.GetComponent <cameraEnd>(); //Calculate and store the offset value by getting the distance between the player's position and camera's position. offset = transform.position - player.transform.position; cam = GetComponent <Camera>(); //the screen position of the two player characters playerCam = cam.WorldToScreenPoint(player.transform.position); player2Cam = cam.WorldToScreenPoint(player2.transform.position); playerAvg = (playerCam.x + player2Cam.x) / 2; //the screen height height = cam.pixelHeight; width = cam.pixelWidth; p1width = player.GetComponent <BoxCollider2D>().bounds.size.x; initCam = (cam.ScreenToWorldPoint(new Vector3(playerAvg + width / 2, height / 2))); initCam -= new Vector3(p1width * 3 / 4, 0); transform.position = initCam; camLeft = new Vector3(0, 0, 0); camRight = new Vector3(0, 0, 0); camLeft = cam.ScreenToWorldPoint(transform.position); Vector3 widThing = new Vector3(width, 0, 0); widThing = cam.ScreenToWorldPoint(widThing); camRight = transform.position + widThing; curCamEnd = firstStopScript.cameraHere; switchStop = false; freezePlayers = false; switchToSecond = false; }
// Use this for initialization void Awake() { S = this; score = new int[numPlayers]; Reset(); }