/// <summary> /// Initializes the variables and objects that are needed by this script. /// </summary> void Start () { PlayerMovement = GetComponent<GoalBallPlayerMovementV1>(); CatchThrow = GetComponent<CatchThrowV2>(); dive = GetComponent<Dive>(); gameTimer = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameTimer>(); }
/// <summary> /// Moves this player to the appropriate spawn based on its selected team and position /// </summary> /// <param name="gbpm">Movement object to change the player's position</param> private void SetSpawn(GoalBallPlayerMovementV1 gbpm) { // Get the NetworkManager NetworkManager_Custom networkManager = GameObject.Find("NetworkManager_Custom").GetComponent<NetworkManager_Custom>(); // Location to spawn the player Transform spawnLoc = gbpm.transform; foreach (Transform startPosition in networkManager.startPositions) { // Check if this start position corresponds with the selected team and position string spName = startPosition.name.ToLower(); if (spName.Contains(networkManager.team.ToLower()) && spName.Contains(networkManager.position.ToLower())) { // This is the position we want spawnLoc = startPosition; gbpm.currentPosition = startPosition.position; break; } } // Tag for the current team string teamTag = "BluePlayer"; // Rotation at which to spawn player and correction (defaults to rotation for blue team) Quaternion spawnRot = Quaternion.Euler(new Vector3(0, 90, 0)); if (spawnLoc.name.ToLower().StartsWith("red")) { // Turn around if on the red team spawnRot = Quaternion.Euler(new Vector3(0, 270, 0)); teamTag = "RedPlayer"; } // Depending on the team, set the proper tag for this player GetComponent<Player_ID>().SetTeamTag(teamTag); // Move the player to the correct position and rotation gbpm.transform.position = spawnLoc.position; gbpm.transform.rotation = spawnRot; }
/// <summary> /// Initializes the variables and objects that are needed by this script. /// </summary> void Start () { PlayerMovement = GetComponent<GoalBallPlayerMovementV1>(); CatchThrow = GetComponent<DEBUGCatchThrowV2>(); dive = GetComponent<Dive>(); }
/// <summary> /// Initializes all of the variables needed for this script. /// </summary> void Start () { GBPM = GetComponent<GoalBallPlayerMovementV1>(); diveCount = 0; player = gameObject; }