Ejemplo n.º 1
0
    public void Death(Packet packet)
    {
        lastMessage = (Message_Death)((PacketSingle)packet).message;
        if (lastMessage.UID != networkUID)
        {
            return;
        }

        // int player = PlayerManager.GetPlayerIDFromCSteamID(new Steamworks.CSteamID(PlayerManager.localUID));

        string name = Steamworks.SteamFriends.GetPersonaName();

        if (lastMessage.message.Contains(name))
        {
            PlayerManager.kills++;
            FlightLogger.Log("You got " + PlayerManager.kills + " Kill(s)");
        }

        FlightLogger.Log(lastMessage.message);

        if (lastMessage.immediate)
        {
            Destroy(gameObject);
        }
        else
        {
            health.invincible = false;
            health.Kill();
        }
    }
Ejemplo n.º 2
0
 protected void LogFlightLog(string msg, params object[] args)
 {
     msg += string.Format("\n{0}\n\n{1}\n",
                          string.Join("\n", FlightLogger.eventLog.ToArray()),
                          FlightLogger.getMissionStats());
     Log(msg, args);
 }
Ejemplo n.º 3
0
    void Death()
    {
        lastMessage.UID       = networkUID;
        lastMessage.immediate = immediateFlag;

        string killerName = "themselves";
        Actor  killer     = null;


        if (health.killedByActor != null)
        {
            killerName = health.killedByActor.name;

            string killerNameImproved = PlayerManager.GetPlayerNameFromActor(health.killedByActor);

            if (killerNameImproved.Length > 2)
            {
                killerName = killerNameImproved;
            }
        }
        string selfName = PlayerManager.GetPlayerNameFromActor(ownerActor);

        if (selfName.Length < 2)
        {
            selfName = ownerActor.name;
        }
        FlightLogger.Log(selfName + " was killed by " + killerName + " with a " + health.killMessage);
        lastMessage.message = selfName + " was killed by " + killerName + " with a " + health.killMessage;

        if (Networker.isHost)
        {
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, lastMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
    }