private void ShowNewMessage(KillMessage message)
        {
            string killerName = playerNameHelper.GetName(message.KillerId, message.KillerType);
            string victimName = playerNameHelper.GetName(message.VictimId, message.VictimType);

            foreach (var killInfoObject in messageObjects)
            {
                Transform transform = killInfoObject.transform;
                transform.localPosition = transform.localPosition + new Vector3(0, -50f);
                killInfoObject.DecreaseTransparency(NewMessageFading);
            }

            if (message.KillerId == currentPlayerId)
            {
                playerKillsCount++;
            }
            aliveCount--;


            KillModel newMessage = Object.Instantiate(messagePrefabPrototype, messagesContainer);

            newMessage.SetKillerName(killerName);
            Texture2D texture2D = Texture2D.whiteTexture;

            // Sprite sprite = Sprite.Create(texture2D, new Rect(0,0,100,100), Vector2.zero);
            newMessage.SetVictimName(victimName);

            // newMessage.SetKillerSprite(sprite);
            // newMessage.SetVictimSprite(sprite);
            //todo установить нормальные спрайты
            // newMessage.SetKillerSprite(PreviewsManager.GetSprite(message.KillerType));
            // newMessage.SetVictimSprite(PreviewsManager.GetSprite(message.VictimType));

            messageObjects.Enqueue(newMessage);
        }
        public KillsIndicatorSystem(KillModel killMessagePrefab, Transform container, Text killsText,
                                    Text aliveText, int aliveCount, PlayerNameHelper playerNameHelper)
        {
            if (killMessagePrefab == null)
            {
                throw new Exception($"{nameof(KillsIndicatorSystem)} {nameof(killMessagePrefab)} was null");
            }
            if (container == null)
            {
                throw new Exception($"{nameof(KillsIndicatorSystem)} {nameof(container)} was null");
            }
            if (killsText == null)
            {
                throw new Exception($"{nameof(KillsIndicatorSystem)} {nameof(killsText)} was null");
            }
            if (aliveText == null)
            {
                throw new Exception($"{nameof(KillsIndicatorSystem)} {nameof(aliveText)} was null");
            }

            messagePrefabPrototype = killMessagePrefab;
            messagesContainer      = container;
            kills                 = killsText;
            alive                 = aliveText;
            messageObjects        = new Queue <KillModel>(MaxMessagesCount);
            currentPlayerId       = PlayerIdStorage.AccountId;
            this.aliveCount       = aliveCount;
            this.playerNameHelper = playerNameHelper;
            alive.text            = aliveCount.ToString("D2");
        }
Example #3
0
        public HttpResponseMessage Close([FromBody] KillModel model)
        {
            if (!model.ComputerName.Equals(ComputerName))
            {
                throw new UnauthorizedAccessException();
            }

            var steamService = new SteamConsoleService(SteamConsolePath);

            steamService.Close();

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
Example #4
0
        public ActionResult Kill(bool isWitch, bool isConstable)
        {
            _sessionRepo.UpdateIsWitch(isWitch);
            _sessionRepo.UpdateIsConstable(isConstable);

            var players = _sessionRepo.GetPlayers();
            var model   = new KillModel(players);

            if (isWitch)
            {
                var m = _sessionRepo.GetVotes();
                model.AddWitchVotes(m.GetWitchVotes());
            }
            return(View(model));
        }