/* * //Called from Cannon.cs when a player enters the lobby. * public void playerJoin(int pID, int teamNo, Color color, Color teamColor) * { * playerList[pID].setID(pID); * playerList[pID].setTeam(teamNo); * playerList[pID].setColor(color); * playerList[pID].setTeamColor(teamColor); * playerList[pID].setActive(true); * } * * //The following getters are called from Cannon.cs to access the protected PlayerDefs class. * public void playerLeave(int pID) { * playerList[pID].reset(); * } * public void setColor(int pID, Color color) { * playerList[pID].setColor(color); * } * public void setSensitivity(int pID, int sens) { * playerList[pID].setSensitivity(sens); * } * public void setInvert(int pID, bool state) { * playerList[pID].setInverted(state); * } * public void setTeam(int pID, int team) { * playerList[pID].setTeam(team); * } * public void setID(int pID) { * playerList[pID].setID(pID); * } * public void setTeamColour(int pId, Color color) { * playerList[pId].setTeamColor(color); * } */ #endregion /* * public void IncrementReadyPlayers() * { * readyPlayers++; * } * * public void DecrementReadyPlayers() * { * readyPlayers--; * } */ //Called immediately when game manager is instantiated in Menu. protected void Awake() { //Ensures there is only one instance of the gameManager, and it isn't destroyed when changing scenes. if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); //Initialize HUD Text List and Spawn Points, will be referenced upon entering game scene. //HUDText = new List<Text>(4); joinText = new List <Text>(4); inputText = new List <Text>(4); spawns = new List <GameObject>(4); playerScores = new List <int>(4); //Initialize HUD, Spawns, Scores, and Colourlist. for (int i = 0; i <= 3; i++) { //HUDText.Add(null); //to be removed when refactoring code joinText.Add(null); inputText.Add(null); spawns.Add(null); players.Add(null); playerScores.Add(0); } //This will need to be changed when the GM is instantiated properly in the menu and carried into the game scene. state = GAMESTATE.SETUP; }
void Awake() { light = this.GetComponentInChildren <Light>(); gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM>(); this.GetComponent <TrailRenderer>().sortingLayerName = this.GetComponent <SpriteRenderer>().sortingLayerName; this.GetComponent <TrailRenderer>().sortingOrder = this.GetComponent <SpriteRenderer>().sortingOrder - 1; }
void Awake() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM>(); rb2d = this.GetComponentInChildren <Rigidbody2D>(); this.GetComponentInChildren <TrailRenderer>().sortingLayerName = this.GetComponent <SpriteRenderer>().sortingLayerName; this.GetComponentInChildren <TrailRenderer>().sortingOrder = this.GetComponent <SpriteRenderer>().sortingOrder - 1; //Record the game mode, for scoring purposes. gameMode = gameManager.gameMode; }
void Start() { // Scale the spawn cooldown based on number of players. gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM>(); int playerCount = gameManager.playerCount; //spawnCooldown = 2f - (0.5f * playerCount); spawnCooldown = -0.5f * playerCount + 2.5f; // Start spawning diamonds StartCoroutine("RecursiveSpawner"); }
void Start() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM>(); gameManager.players[playerId] = this; joinText = GameObject.Find("JoinText" + playerId); inputText = GameObject.Find("InputText" + playerId); laserRB = pairedLaser.GetComponent <Rigidbody2D>(); rewiredPlayer = ReInput.players.GetPlayer(playerId); inFlight = false; sensitivity = 5; midPoint = transform.Find("MidPoint").transform; cornerOrigin = new Vector2(midPoint.transform.position.x, midPoint.transform.position.y); Layer_Mask = LayerMask.GetMask("Boundary"); colorIdx = playerId; gameManager.UpdateColour(colorIdx, playerId); inputText.GetComponent <Text>().color = myColor; joinText.GetComponent <Text>().text = ""; if (gameManager.gameMode == "FFA") { team = playerId + 1; } else { team = 0; } //Setup for rotation. if (maxAngleOffset < 0) { maxAngleOffset *= -1; } currentRotationSpeed = baseRotationSpeed; SetNewBaseAngle(); }
void Awake() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM>(); rewiredPlayer = ReInput.players.GetPlayer(playerID); }
void Start() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM>(); }
void Start() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <BaseGM> (); StartCoroutine(RecursiveSpawner()); }