public virtual void Shoot() { holdState = HoldState.CanHold; playerState = PlayerState.None; holdMovableTransform.gameObject.tag = "ThrownMovable"; MovableScript movableScript = holdMovableTransform.gameObject.GetComponent <MovableScript>(); movableScript.slowMoTrigger.triggerEnabled = true; movableScript.hold = false; holdMovableTransform.transform.SetParent(null); holdMovableTransform.transform.SetParent(movableParent); movableScript.playerThatThrew = gameObject; movableScript.AddRigidbody(); holdMovableRB = movableScript.rigidbodyMovable; movableScript.OnRelease(); movableScript.currentVelocity = 250; holdMovableRB.AddForce(transform.forward * shootForce, ForceMode.VelocityChange); playerRigidbody.AddForce(transform.forward * -holdMovableRB.mass * 5, ForceMode.VelocityChange); if (OnShoot != null) { OnShoot(); } }
protected virtual IEnumerator DeathCoroutine() { playerState = PlayerState.Dead; GameAnalytics.NewDesignEvent("Player:" + name + ":" + GlobalVariables.Instance.CurrentModeLoaded.ToString() + ":LifeDuration", StatsManager.Instance.playersStats[playerName.ToString()].playersStats[WhichStat.LifeDuration.ToString()]); GlobalVariables.Instance.screenShakeCamera.CameraShaking(FeedbackType.Death); GlobalVariables.Instance.zoomCamera.Zoom(FeedbackType.Death); PlayerStats(playerThatHit); if (gettingMovable || holdState == HoldState.Holding) { yield return(new WaitWhile(() => gettingMovable == true)); MovableScript movableScript = holdMovableTransform.gameObject.GetComponent <MovableScript>(); movableScript.hold = false; holdMovableTransform.tag = "Movable"; holdMovableTransform.SetParent(null); holdMovableTransform.SetParent(movableParent); if (movableScript.rigidbodyMovable == null) { movableScript.AddRigidbody(); } movableScript.OnRelease(); } holdState = HoldState.CannotHold; gameObject.SetActive(false); RemoveFromAIObjectives(); if (GlobalVariables.Instance != null) { GlobalVariables.Instance.ListPlayers(); } GlobalVariables.Instance.lastManManager.PlayerDeath(playerName, gameObject); if (OnDeath != null) { OnDeath(); } }