private void Start()
 {
     playerdeath    = FindObjectOfType <OnPlayerDeath>();
     player         = transform.parent.transform.parent.gameObject; // gets the correct gameObject
     playerMovement = player.GetComponent <Movement>();
 }
Beispiel #2
0
 public static void InvokePlayerDeath()
 {
     OnPlayerDeath.Invoke();
 }
Beispiel #3
0
 public static void PlayerDeath()
 {
     OnPlayerDeath?.Invoke();
 }
Beispiel #4
0
        internal static void TriggerSend(SteamPlayer s, string W, ESteamCall X, ESteamPacket l, params object[] R)
        {
            try
            {
                if (s == null || s.player == null || s.playerID.steamID == CSteamID.Nil || s.player.transform == null || R == null)
                {
                    return;
                }
                UnturnedPlayerEvents instance = s.player.transform.GetComponent <UnturnedPlayerEvents>();
                UnturnedPlayer       rp       = UnturnedPlayer.FromSteamPlayer(s);
#if DEBUG
                //string o = "";
                //foreach (object r in R)
                //{
                //    o += r.ToString();
                //}
                //Logger.Log("Send+" + s.SteamPlayerID.CSteamID.ToString() + ": " + W + " - " + o);
#endif
                if (W.StartsWith("tellWear"))
                {
                    OnPlayerWear.TryInvoke(rp, Enum.Parse(typeof(Wearables), W.Replace("tellWear", "")), (ushort)R[0], R.Count() > 1 ? (byte?)R[1] : null);
                }
                switch (W)
                {
                case "tellBleeding":
                    OnPlayerUpdateBleeding.TryInvoke(rp, (bool)R[0]);
                    instance.OnUpdateBleeding.TryInvoke(rp, (bool)R[0]);
                    break;

                case "tellBroken":
                    OnPlayerUpdateBroken.TryInvoke(rp, (bool)R[0]);
                    instance.OnUpdateBroken.TryInvoke(rp, (bool)R[0]);
                    break;

                case "tellLife":
                    OnPlayerUpdateLife.TryInvoke(rp, (byte)R[0]);
                    instance.OnUpdateLife.TryInvoke(rp, (byte)R[0]);
                    break;

                case "tellFood":
                    OnPlayerUpdateFood.TryInvoke(rp, (byte)R[0]);
                    instance.OnUpdateFood.TryInvoke(rp, (byte)R[0]);
                    break;

                case "tellHealth":
                    OnPlayerUpdateHealth.TryInvoke(rp, (byte)R[0]);
                    instance.OnUpdateHealth.TryInvoke(rp, (byte)R[0]);
                    break;

                case "tellVirus":
                    OnPlayerUpdateVirus.TryInvoke(rp, (byte)R[0]);
                    instance.OnUpdateVirus.TryInvoke(rp, (byte)R[0]);
                    break;

                case "tellWater":
                    OnPlayerUpdateWater.TryInvoke(rp, (byte)R[0]);
                    instance.OnUpdateWater.TryInvoke(rp, (byte)R[0]);
                    break;

                case "tellStance":
                    OnPlayerUpdateStance.TryInvoke(rp, (byte)R[0]);
                    instance.OnUpdateStance.TryInvoke(rp, (byte)R[0]);
                    break;

                case "tellGesture":
                    OnPlayerUpdateGesture.TryInvoke(rp, (PlayerGesture)Enum.Parse(typeof(PlayerGesture), R[0].ToString()));
                    instance.OnUpdateGesture.TryInvoke(rp, (PlayerGesture)Enum.Parse(typeof(PlayerGesture), R[0].ToString()));
                    break;

                case "tellStat":
                    OnPlayerUpdateStat.TryInvoke(rp, (EPlayerStat)(byte)R[0]);
                    instance.OnUpdateStat.TryInvoke(rp, (EPlayerStat)(byte)R[0]);
                    break;

                case "tellExperience":
                    OnPlayerUpdateExperience.TryInvoke(rp, (uint)R[0]);
                    instance.OnUpdateExperience.TryInvoke(rp, (uint)R[0]);
                    break;

                case "tellRevive":
                    OnPlayerRevive.TryInvoke(rp, (Vector3)R[0], (byte)R[1]);
                    instance.OnRevive.TryInvoke(rp, (Vector3)R[0], (byte)R[1]);
                    break;

                case "tellDead":
                    OnPlayerDead.TryInvoke(rp, (Vector3)R[0]);
                    instance.OnDead.TryInvoke(rp, (Vector3)R[0]);
                    break;

                case "tellDeath":
                    OnPlayerDeath.TryInvoke(rp, (EDeathCause)(byte)R[0], (ELimb)(byte)R[1], new CSteamID(ulong.Parse(R[2].ToString())));
                    instance.OnDeath.TryInvoke(rp, (EDeathCause)(byte)R[0], (ELimb)(byte)R[1], new CSteamID(ulong.Parse(R[2].ToString())));
                    break;

                default:
#if DEBUG
                    // Logger.Log("Send+" + s.SteamPlayerID.CSteamID.ToString() + ": " + W + " - " + String.Join(",",R.Select(e => e.ToString()).ToArray()));
#endif
                    break;
                }
                return;
            }
            catch (Exception ex)
            {
                Core.Logging.Logger.LogException(ex, "Failed to receive packet \"" + W + "\"");
            }
        }
Beispiel #5
0
 public override void Die()
 {
     base.Die();
     OnPlayerDeath?.Invoke("");
 }
 private void OnDeath()
 {
     OnPlayerDeath.Invoke();
 }
Beispiel #7
0
 protected override void Die()
 {
     OnPlayerDeath?.Invoke();
     PlayDeathSound();
     gameObject.SetActive(false);
 }
Beispiel #8
0
 public void PlayerDied(TypeOfDeath typeOfDeath) =>
 OnPlayerDeath?.Invoke(typeOfDeath);
Beispiel #9
0
 public void Die()
 {
     Debug.Log("You died...");
     OnPlayerDeath?.Invoke();
 }
 public void OnDestruction(GameObject destroyer)
 {
     OnPlayerDeath?.Invoke();
     Destroy(gameObject);
 }
Beispiel #11
0
 internal void PlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause,
                           Vector2 position, int killerIndex)
 {
     OnPlayerDeath?.Invoke(this,
                           new PlayerDeathEventArgs(player, corpse, playerIndex, cause, position, killerIndex));
 }
Beispiel #12
0
 protected override void HandleDeath(GameObject attacker)
 {
     GetComponent <Persona>().WriteOutPutCard("Incomplete");
     OnPlayerDeath.Invoke();
     Destroy(gameObject);
 }
 public void ProcessPlayerDeath()
 {
     PlayerDeaths += 1;
     OnPlayerDeath.Invoke();
     SceneLoader.ReloadScene();
 }
Beispiel #14
0
 private void Start()
 {
     deathScript           = FindObjectOfType <OnPlayerDeath>();
     Application.quitting += GameIsQuitting;
 }
Beispiel #15
0
 /// <summary>
 /// Уведомляет подписчиков (GameMaster) о смерти игрока.
 /// </summary>
 public void PlayerIsDead()
 {
     OnPlayerDeath?.Invoke();
 }
Beispiel #16
0
 private void Start()
 {
     playerDeath = FindObjectOfType <OnPlayerDeath>();
 }
Beispiel #17
0
 public void Died() => OnPlayerDeath?.Invoke();
 private void Die()
 {
     OnPlayerDeath?.Invoke();
     Destroy(gameObject);
 }
 public void OnPlayerDeathInVoke()
 {
     OnPlayerDeath?.Invoke();
 }
Beispiel #20
0
 public void On(OnPlayerDeath message) => enabled         = false;
 public void PlayerDeathTrigger()
 {
     GameManager.singleton.StartCoroutine(DeathPlayerAnim());
     SFXManager.PlaySFX(SFXManager.Death, SFXManager.PlayerAudioSource);
     OnPlayerDeath?.Invoke();
 }
Beispiel #22
0
 public void PlayerDeath(Transform location)
 {
     OnPlayerDeath?.Invoke(location);
 }
 public void PlayerIsDead()
 {
     _currentGameStats.IncrementDeathVal();
     OnPlayerDeath?.Invoke(newText: "U r Ded - Return::Main");
 }
Beispiel #24
0
        /// <summary>
        ///     A static instance of the Events class, where the events are invoked
        /// </summary>
        static Events()
        {
            // Invoke the OnPlayerDeath event

            #region OnPlayerDeath

            try
            {
                // Every time the player plays an animation
                Obj_AI_Base.OnPlayAnimation += delegate(Obj_AI_Base sender, GameObjectPlayAnimationEventArgs args)
                {
                    // If the player fired the event and the animation's name to lower is the death animation's name
                    if (sender.IsMe && args.Animation.ToLower().Contains("death"))
                    {
                        // The player has died; Invoke the OnPlayerDeath event
                        OnPlayerDeath?.Invoke(sender, EventArgs.Empty);
                    }
                };
            }
            catch (Exception ex)
            {
                // Exception has been cought; Notify the user of the error and print the exception to the console
                Logger.Send("Exception occurred on initialization of AutoShop event OnPlayerDeath:", ex, Logger.LogLevel.Error);

                // Warn the user that AutoShop may not be functioning correctly
                Logger.Send("Exception occurred during AutoShop initialization. AutoShop will most likely NOT work properly!", Logger.LogLevel.Warn);
            }

            #endregion

            // Invoke the OnBuyAllow event

            #region OnBuyAllow

            try
            {
                // When the game loads the first time, invoke the event
                Game.OnLoad += delegate { OnBuyAllow(EventArgs.Empty); };

                // When the player dies, invoke the event
                //OnPlayerDeath += delegate { OnBuyAllow(EventArgs.Empty); };

                // When the player losses the disable shopping buff
                Obj_AI_Base.OnBuffLose += delegate(Obj_AI_Base sender, Obj_AI_BaseBuffLoseEventArgs args)
                {
                    if (sender.IsMe && args.Buff.DisplayName.Equals("aramshopdisableplayer", StringComparison.CurrentCultureIgnoreCase))
                    {
                        Buy.CanShop = true;
                        OnBuyAllow(EventArgs.Empty);
                    }
                };
                Obj_AI_Base.OnBuffGain += delegate(Obj_AI_Base sender, Obj_AI_BaseBuffGainEventArgs args)
                {
                    if (sender.IsMe && args.Buff.DisplayName.Equals("aramshopdisableplayer", StringComparison.CurrentCultureIgnoreCase))
                    {
                        Buy.CanShop = false;
                    }
                };
            }
            catch (NullReferenceException ex)
            {
                // Exception has been cought; Notify the user of the error and print the exception to the console
                Logger.Send("Exception occurred on initialization of AutoShop event OnBuyAllow.", ex, Logger.LogLevel.Error);

                // Warn the user that AutoShop may not be functioning correctly
                Logger.Send("Exception occurred during AutoShop events initialization. AutoShop will most likely NOT work properly!", Logger.LogLevel.Warn);
            }

            #endregion

            // Invoke the OnBuildReset event

            #region OnBuildReset

            try
            {
                // Every time the user inputs something into the chat
                Chat.OnInput += delegate(ChatInputEventArgs args)
                {
                    // Proceed if the user's input in lower, sides trimmed of whitespace is "/buildmanager reset"
                    if (args.Input.ToLower().Trim() == "/buildmanager reset")
                    {
                        // Invoke the OnBuildReset event
                        OnBuildReset(EventArgs.Empty);

                        // Don't process the event, so the user doesn't get that annoying command not recognized message
                        args.Process = false;
                    }
                };
            }
            catch (Exception ex)
            {
                // Exception has been cought; Notify the user of the error and print the exception to the console
                Logger.Send("Exception occurred on initialization of AutoShop event OnBuildReset:", ex, Logger.LogLevel.Error);

                // Warn the user that AutoShop may not be functioning correctly
                Logger.Send("Exception occurred during AutoShop initialization. AutoShop will most likely NOT work properly!", Logger.LogLevel.Warn);
            }

            #endregion

            // Notify the user that events are functioning correctly
            Logger.Send("Events have been succesfully set up!");
        }
Beispiel #25
0
 private void OnDeath()
 {
     Debug.LogWarning("YOU ARE DEAD!");
     OnPlayerDeath?.Invoke();
 }
Beispiel #26
0
 /// <summary>
 /// Invoke <see cref="OnPlayerDeath"/>.
 /// </summary>
 public void PlayerDied()
 {
     OnPlayerDeath?.Invoke();
 }
 public void Die()
 {
     ObjectPooler.Instance.SpawnFromPool("death effect", transform.position, transform.rotation);
     OnPlayerDeath?.Invoke();
     gameObject.SetActive(false);
 }
 public void On(OnPlayerDeath message)
 {
     playerDeathPosition  = message.deathPosition;
     playerDeathSceneName = message.deathSceneName;
 }
Beispiel #29
0
 protected override void Die()
 {
     OnPlayerDeath?.Invoke();
     base.Die();
 }
Beispiel #30
0
        public override void Die()
        {
            StatisticsManager.Instance.AddIntValue("Player.Deaths", 1);

            OnPlayerDeath?.Invoke();
        }