Пример #1
0
    protected override void OnDeathActions()
    {
        if (CustomNetworkManager.Instance._isServer)
        {
            PlayerNetworkActions pna = gameObject.GetComponent <PlayerNetworkActions>();
            PlayerMove           pm  = gameObject.GetComponent <PlayerMove>();

            ConnectedPlayer player = PlayerList.Instance.Get(gameObject);

            string killerName = "Stressful work";
            if (LastDamagedBy != null)
            {
                killerName = PlayerList.Instance.Get(LastDamagedBy).Name;
            }

            string playerName = player.Name ?? "dummy";
            if (killerName == playerName)
            {
                PostToChatMessage.Send(playerName + " commited suicide", ChatChannel.System);                 //Killfeed
            }
            else if (killerName.EndsWith(playerName))
            {
                // chain reactions
                PostToChatMessage.Send(
                    playerName + " screwed himself up with some help (" + killerName + ")",
                    ChatChannel.System);                     //Killfeed
            }
            else
            {
                PlayerList.Instance.UpdateKillScore(LastDamagedBy, gameObject);
            }
            pna.DropItem("rightHand");
            pna.DropItem("leftHand");

            if (isServer)
            {
                EffectsFactory.Instance.BloodSplat(transform.position, BloodSplatSize.large);
            }

            PlayerDeathMessage.Send(gameObject);
            //syncvars for everyone
            pm.isGhost    = true;
            pm.allowInput = true;
            //consider moving into PlayerDeathMessage.Process()
            pna.RpcSpawnGhost();
            RpcPassBullets(gameObject);

            //FIXME Remove for next demo
            pna.RespawnPlayer(10);
        }
    }
Пример #2
0
    public override void Death(bool gibbed = false)
    {
        if (CustomNetworkManager.Instance._isServer)
        {
            PlayerNetworkActions pNet = GetComponent <PlayerNetworkActions>();
            pNet.RpcSpawnGhost();

            PlayerMove pM = GetComponent <PlayerMove>();
            pM.isGhost    = true;
            pM.allowInput = true;
            if (lastDamager == gameObject.name)
            {
                pNet.CmdSendAlertMessage("<color=red><b>" + gameObject.name + " commited suicide</b></color>",
                                         true);             //killfeed
            }
            else if (lastDamager.EndsWith(gameObject.name)) // chain reactions
            {
                pNet.CmdSendAlertMessage("<color=red><b>" + gameObject.name + " screwed himself up with some help (" +
                                         lastDamager
                                         + ")</b></color>",
                                         true); //killfeed
            }
            else
            {
                PlayerList.Instance.UpdateKillScore(lastDamager);
                pNet.CmdSendAlertMessage(
                    "<color=red><b>" + lastDamager + "</b> has killed <b>" + gameObject.name + "</b></color>", true);              //killfeed
            }
            countRespawn = true;
            respawnTime  = 0f;
            GetComponent <PlayerNetworkActions>().CmdDropItem("leftHand");
            GetComponent <PlayerNetworkActions>().CmdDropItem("rightHand");
            gameObject.GetComponent <WeaponNetworkActions>().BloodSplat(transform.position, Sprites.BloodSplatSize.medium);
            Debug.Log("respawn initiated..");
        }
        mobStat = MobConsciousStat.DEAD;
        base.Death(gibbed);
    }
Пример #3
0
        protected override void OnDeathActions()
        {
            if (CustomNetworkManager.Instance._isServer)
            {
                playerNetworkActions.RpcSpawnGhost();

                PlayerMove pM = GetComponent <PlayerMove>();
                pM.isGhost    = true;
                pM.allowInput = true;
                if (LastDamagedBy == gameObject.name)
                {
                    playerNetworkActions.CmdSendAlertMessage("<color=red><b>" + gameObject.name + " commited suicide</b></color>",
                                                             true); //killfeed
                }
                else if (LastDamagedBy.EndsWith(gameObject.name))   // chain reactions
                {
                    playerNetworkActions.CmdSendAlertMessage("<color=red><b>" + gameObject.name + " screwed himself up with some help (" +
                                                             LastDamagedBy
                                                             + ")</b></color>",
                                                             true); //killfeed
                }
                else
                {
                    PlayerList.Instance.UpdateKillScore(LastDamagedBy);
                    playerNetworkActions.CmdSendAlertMessage(
                        "<color=red><b>" + LastDamagedBy + "</b> has killed <b>" + gameObject.name + "</b></color>", true);                         //killfeed
                }
                playerNetworkActions.ValidateDropItem("leftHand", true);
                playerNetworkActions.ValidateDropItem("rightHand", true);
                if (isServer)
                {
                    EffectsFactory.Instance.BloodSplat(transform.position, BloodSplatSize.large);
                }

                //FIXME Remove for next demo
                playerNetworkActions.RespawnPlayer(10);
            }
        }
Пример #4
0
    // Use this for initialization
    public override void Death(bool gibbed)
    {
        if (CustomNetworkManager.Instance._isServer)
        {
            PlayerNetworkActions pNet = GetComponent <PlayerNetworkActions>();
            pNet.RpcSpawnGhost();

            PlayerMove pM = GetComponent <PlayerMove>();
            pM.isGhost    = true;
            pM.allowInput = true;
            if (lastDamager != gameObject.name)
            {
                PlayerList.Instance.UpdateKillScore(lastDamager);
                pNet.CmdSendAllertMessage("<color=red><b>" + lastDamager + "</b> has killed <b>" + gameObject.name + "</b></color>", true);         //killfeed
            }
            else
            {
                pNet.CmdSendAllertMessage("<color=red><b>" + gameObject.name + " commited suicide</b></color>", true);             //killfeed
            }
        }
        mobStat = MobConsciousStat.DEAD;
        base.Death(gibbed);
    }
Пример #5
0
        protected override void OnDeathActions()
        {
            if (CustomNetworkManager.Instance._isServer)
            {
                if (LastDamagedBy == gameObject.name)
                {
                    PostToChatMessage.Send(gameObject.name + " commited suicide", ChatChannel.System); //Killfeed
                }
                else if (LastDamagedBy.EndsWith(gameObject.name))
                {
                    // chain reactions
                    PostToChatMessage.Send(
                        gameObject.name + " screwed himself up with some help (" + LastDamagedBy + ")",
                        ChatChannel.System); //Killfeed
                }
                else
                {
                    PlayerList.Instance.UpdateKillScore(LastDamagedBy);
                    PostToChatMessage.Send(LastDamagedBy + " has killed " + gameObject.name,
                                           ChatChannel.System); //Killfeed
                }
                playerNetworkActions.ValidateDropItem("rightHand", true);
                playerNetworkActions.ValidateDropItem("leftHand", true);

                if (isServer)
                {
                    EffectsFactory.Instance.BloodSplat(transform.position, BloodSplatSize.large);
                }

                playerNetworkActions.RpcSpawnGhost();
                playerMove.isGhost    = true;
                playerMove.allowInput = true;

                //FIXME Remove for next demo
                playerNetworkActions.RespawnPlayer(10);
            }
        }
Пример #6
0
        protected override void OnDeathActions()
        {
            if (CustomNetworkManager.Instance._isServer)
            {
                PlayerNetworkActions pna = gameObject.GetComponent <PlayerNetworkActions>();
                PlayerMove           pm  = gameObject.GetComponent <PlayerMove>();

                ConnectedPlayer player = PlayerList.Instance.Get(gameObject);

                string killerName = "stressfull work";
                if (LastDamagedBy != null)
                {
                    killerName = PlayerList.Instance.Get(LastDamagedBy).Name;
                }

                if (killerName == player.Name)
                {
                    PostToChatMessage.Send(player.Name + " commited suicide", ChatChannel.System);                     //Killfeed
                }
                else if (killerName.EndsWith(player.Name))
                {
                    // chain reactions
                    PostToChatMessage.Send(
                        player.Name + " screwed himself up with some help (" + killerName + ")",
                        ChatChannel.System);                         //Killfeed
                }
                else
                {
                    PlayerList.Instance.UpdateKillScore(LastDamagedBy, gameObject);

                    string departmentKillText = "";
                    if (LastDamagedBy != null)
                    {
                        JobDepartment killerDepartment =
                            SpawnPoint.GetJobDepartment(LastDamagedBy.GetComponent <PlayerScript>().JobType);
                        JobDepartment victimDepartment =
                            SpawnPoint.GetJobDepartment(gameObject.GetComponent <PlayerScript>().JobType);

                        if (killerDepartment == victimDepartment)
                        {
                            departmentKillText = ", losing " + killerDepartment.GetDescription() +
                                                 " 1 point for team killing!";
                        }
                        else
                        {
                            departmentKillText = ", 1 point to " + killerDepartment.GetDescription() + "!";
                        }
                    }

                    //TDM demo killfeed
                    PostToChatMessage.Send(killerName + " has killed " + player.Name + departmentKillText,
                                           ChatChannel.System);

                    //Combat demo killfeed
                    //PostToChatMessage.Send(killerName + " has killed " + gameObject.name, ChatChannel.System);
                }
                pna.ValidateDropItem("rightHand", true, transform.position);
                pna.ValidateDropItem("leftHand", true, transform.position);

                if (isServer)
                {
                    EffectsFactory.Instance.BloodSplat(transform.position, BloodSplatSize.large);
                }

                pna.RpcSpawnGhost();
                pm.isGhost    = true;
                pm.allowInput = true;
                RpcPassBullets(gameObject);
                PlayerDeathMessage.Send(gameObject);

                //FIXME Remove for next demo
                pna.RespawnPlayer(10);
            }
        }