예제 #1
0
        private void FlagTaken(Flag flag, FlagCarrier flagCarrier)
        {
            if (flag != null && flag.entity != null && flag.entity.isAttached && flag.entity.isOwner)
            {
                flag.isHome  = false;
                flag.carrier = flagCarrier.Robot.entity;

                flagHeldTime     = 0;
                this.flagCarrier = flagCarrier;

                if (flagCarrier != null && flagCarrier.Robot != null)
                {
                    PlayerManager.Instance.SetPlayerTeam(flagCarrier.Robot.PlayerGuid, 1);

                    string message = PlayerManager.Instance.PlayerFromGuid(flagCarrier.Robot.PlayerGuid).displayName + " has taken the flag and is now the Rabbit.";
                    SendEventHandler.SendToastMessageEvent(message, 2, "FlagTaken");
                }

                flagCarrier.OnGrabFlag(flag);
            }
        }
예제 #2
0
        protected void FlagTaken(Flag flag, FlagCarrier flagCarrier)
        {
            if (flag != null && flag.entity != null && flag.entity.isAttached && flag.entity.isOwner)
            {
                flag.isHome  = false;
                flag.carrier = flagCarrier.Robot.entity;

                if (flagCarrier != null && flagCarrier.Robot != null)
                {
                    if (flag.teamID == 1)
                    {
                        string message = PlayerManager.Instance.PlayerFromGuid(flagCarrier.Robot.PlayerGuid).displayName + " has taken " + gameState.team1Name + "'s flag!";
                        SendEventHandler.SendToastMessageEvent(message, 2, "FlagTaken");
                    }
                    else if (flag.teamID == 2)
                    {
                        string message = PlayerManager.Instance.PlayerFromGuid(flagCarrier.Robot.PlayerGuid).displayName + " has taken " + gameState.team2Name + "'s flag!";
                        SendEventHandler.SendToastMessageEvent(message, 1, "FlagTaken");
                    }
                }

                flagCarrier.OnGrabFlag(flag);
            }
        }