public void RpcRespawn(Vector3 location) { this.transform.position = location; PlayerMovement.AllowMovement = true; ActionsInRound = new PlayersActionsInRound(); CurrentHealth = MaxHealth; IsDead = false; CurrentFrameNumber = 0; }
/// <summary> /// Function that runs at the start of the scene /// </summary> void Start() { ActionsInRound = new PlayersActionsInRound(); DamageFlashColour = new Color(1f, 0f, 0f, 0.1f); PlayerMovement = GetComponentInParent <FPSInput>(); PreviousMovement = new Vector3(); PreviousRotation = new Quaternion(); PreviousMovement = transform.position; PreviousRotation = transform.rotation; }
// Post round IEnumerator PostProcessing() { foreach (Player player in players.Values) { player.RpcPlaySound(Assets.Scripts.SoundController.PlayMode.WaitAndBlock, SoundEffects.RoundOver); } // Clean up and get recording foreach (Player player in players.Values) { PlayersActionsInRound action = new PlayersActionsInRound(); action = player.GetPlayerActions(); GameObject clone = new GameObject(); if (player.Team == Teams.Blue) { clone = CreateClone(BluePlayerStart, action, Teams.Blue); BlueTeamClones.Add(clone); } else { clone = CreateClone(RedPlayerStart, action, Teams.Red); RedTeamClones.Add(clone); } CmdSpawnClone(clone); } // Find winner foreach (Player y in players.Values) { if (y.IsAlive()) { Debug.Log("Winner"); y.RpcAddWin(); } } // Set players to alive foreach (Player player in players.Values) { player.IsDead = false; //y.PlayerMovement.AllowMovement = true; } //Debug.Log("round 6"); // End CurrentRound++; StageInProgress = 0; yield return(null); }
/// <summary> /// Function that runs at the start of the scene /// </summary> void Start() { InitializeGlow(); ActionsInRound = new PlayersActionsInRound(); DamageFlashColour = new Color(1f, 0f, 0f, 0.1f); PlayerMovement = GetComponentInParent <FPSInput>(); PreviousMovement = new Vector3(); PreviousRotation = new Quaternion(); PreviousMovement = transform.position; PreviousRotation = transform.rotation; NumberBullets = ClipSize; RoundText = this.transform.Find("Canvas").transform.Find("Text").GetComponent <Text>(); WinText = this.transform.Find("Canvas").transform.Find("Text (1)").GetComponent <Text>(); RoundText.text = "Round: 0"; WinText.text = "Wins: 0"; switch (Random.Range(1, 7)) { case 1: SoundManager.ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode.Immediate, SoundEffects.Music1); break; case 2: SoundManager.ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode.Immediate, SoundEffects.Music2); break; case 3: SoundManager.ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode.Immediate, SoundEffects.Music3); break; case 4: SoundManager.ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode.Immediate, SoundEffects.Music4); break; case 5: SoundManager.ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode.Immediate, SoundEffects.Music5); break; case 6: SoundManager.ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode.Immediate, SoundEffects.Music6); break; } }
/// <summary> /// Function that runs at the start of the scene /// </summary> void Start() { IsDead = false; ActionsInRound = new PlayersActionsInRound(); Damaged = false; CurrentHealth = 100; DamageFlashColour = new Color(1f, 0f, 0f, 0.1f); PlayerMovement = GetComponentInParent <FPSInput>(); PreviousMovement = new Vector3(); PreviousRotation = new Quaternion(); PreviousMovement = transform.position; PreviousRotation = transform.rotation; _camera = GetComponent <Camera>(); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
/// <summary> /// Creates a new clone object at the specified starting position, that will use the passed in actions /// </summary> /// <param name="StartingPosition"></param> /// <param name="ActionReader"></param> /// <returns></returns> private GameObject CreateClone(Vector3 StartingPosition, PlayersActionsInRound ActionReader, Teams Team) { if (ActionReader == null) { Debug.Log("Cannot pass in a null starting position or action reader when creating a clone"); return(null); } if (ClonePrefab == null) { Debug.Log("Must set the clone prefab before creating a clone"); return(null); } GameObject Clone = (GameObject)Instantiate(ClonePrefab); CloneController Controller = Clone.GetComponent <CloneController>(); if (Controller == null) { Debug.Log("Cannot create a clone instance using a prefab that doesn't have the clone controller component!"); return(null); } Controller.SetStartingPosition(StartingPosition); Controller.SetActionReader(ActionReader); if (BoundsCheck != null) { Controller.SetBoundsCheck(BoundsCheck.GetComponent <Collider>()); } else { Debug.Log("RoundManager doesn't have a set bounds check!"); } Controller.Team = Team; Controller.RpcSetGlow(Team); return(Clone); }
/// <summary> /// Sets the actions that the clone should be imatating. /// </summary> /// <param name="actions"></param> internal void SetActionReader(PlayersActionsInRound actions) { CurrentFrameNumber = 0; Actions = actions; }
internal void ResetActions() { ActionsInRound = new PlayersActionsInRound(); }