Esempio n. 1
0
        private void UpdateTransitionState(float deltaTime, Character character)
        {
            IncubationTimer += deltaTime / IncubationDuration;

            if (state == InfectionState.Dormant && Character.Controlled == character)
            {
                new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak"));
            }

            state = InfectionState.Transition;
        }
Esempio n. 2
0
        private void UpdateActiveState(float deltaTime, Character character)
        {
            if (state != InfectionState.Active)
            {
                if (Character.Controlled == character)
                {
                    new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate"));
                }
                ActivateHusk(character);
                state = InfectionState.Active;
            }

            character.AddDamage(CauseOfDeath.Husk, 0.5f * deltaTime, null);
        }
Esempio n. 3
0
        partial void KillProjSpecific()
        {
            if (GameMain.NetworkMember != null && Character.controlled == this)
            {
                string chatMessage = InfoTextManager.GetInfoText("Self_CauseOfDeath." + causeOfDeath.ToString());
                if (GameMain.Client != null)
                {
                    chatMessage += " Your chat messages will only be visible to other dead players.";
                }

                GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
                GameMain.LightManager.LosEnabled = false;
                controlled = null;
            }

            PlaySound(CharacterSound.SoundType.Die);
        }
Esempio n. 4
0
        private void UpdateDormantState(float deltaTime, Character character)
        {
            float prevTimer = IncubationTimer;

            state = InfectionState.Dormant;

            IncubationTimer += deltaTime / IncubationDuration;

            if (Character.Controlled != character)
            {
                return;
            }

            if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f)
            {
                GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f);
            }
        }
Esempio n. 5
0
 partial void UpdateProjSpecific(float prevTimer, Character character)
 {
     if (IncubationTimer < 0.5f)
     {
         if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f)
         {
             GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f);
         }
     }
     else if (IncubationTimer < 1.0f)
     {
         if (state == InfectionState.Dormant && Character.Controlled == character)
         {
             new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak"));
         }
     }
     else if (state != InfectionState.Active && Character.Controlled == character)
     {
         new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate"));
     }
 }
Esempio n. 6
0
        public GUIFrame CreateSummaryFrame(string endMessage)
        {
            bool singleplayer = GameMain.NetworkMember == null;

            bool gameOver = gameSession.CrewManager.characters.All(c => c.IsDead);
            bool progress = Submarine.MainSub.AtEndPosition;

            GUIFrame frame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.8f, null);

            int      width = 760, height = 400;
            GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "", frame);

            int y = 0;

            if (singleplayer)
            {
                string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
                                                                 (progress ? "progress" : "return"));

                var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
                y += infoText.Rect.Height;
            }


            if (!string.IsNullOrWhiteSpace(endMessage))
            {
                var endText = new GUITextBlock(new Rectangle(0, y, 0, 30), endMessage, "", innerFrame, true);

                y += 30 + endText.Text.Split('\n').Length * 20;
            }

            new GUITextBlock(new Rectangle(0, y, 0, 20), "Crew status:", "", innerFrame, GUI.LargeFont);
            y += 30;

            GUIListBox listBox = new GUIListBox(new Rectangle(0, y, 0, 90), null, Alignment.TopLeft, "", innerFrame, true);

            int x = 0;

            foreach (CharacterInfo characterInfo in gameSession.CrewManager.CharacterInfos)
            {
                if (GameMain.GameSession.Mission is CombatMission &&
                    characterInfo.TeamID != GameMain.GameSession.CrewManager.WinningTeam)
                {
                    continue;
                }

                var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), Color.Transparent, "", listBox);
                characterFrame.OutlineColor = Color.Transparent;
                characterFrame.Padding      = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
                characterFrame.CanBeFocused = false;

                characterInfo.CreateCharacterFrame(characterFrame,
                                                   characterInfo.Job != null ? (characterInfo.Name + '\n' + "(" + characterInfo.Job.Name + ")") : characterInfo.Name, null);

                string statusText  = "OK";
                Color  statusColor = Color.DarkGreen;

                Character character = characterInfo.Character;
                if (character == null || character.IsDead)
                {
                    statusText  = InfoTextManager.GetInfoText("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
                    statusColor = Color.DarkRed;
                }
                else
                {
                    if (character.IsUnconscious)
                    {
                        statusText  = "Unconscious";
                        statusColor = Color.DarkOrange;
                    }
                    else if (character.Health / character.MaxHealth < 0.8f)
                    {
                        statusText  = "Injured";
                        statusColor = Color.DarkOrange;
                    }
                }

                new GUITextBlock(
                    new Rectangle(0, 0, 0, 20), statusText, statusColor * 0.8f, Color.White,
                    Alignment.BottomLeft, Alignment.Center,
                    null, characterFrame, true, GUI.SmallFont);

                x += characterFrame.Rect.Width + 10;
            }

            y += 120;

            if (GameMain.GameSession.Mission != null)
            {
                new GUITextBlock(new Rectangle(0, y, 0, 20), "Mission: " + GameMain.GameSession.Mission.Name, "", innerFrame, GUI.LargeFont);
                y += 30;

                new GUITextBlock(new Rectangle(0, y, innerFrame.Rect.Width - 170, 0),
                                 (GameMain.GameSession.Mission.Completed) ? GameMain.GameSession.Mission.SuccessMessage : GameMain.GameSession.Mission.FailureMessage,
                                 "", innerFrame, true);

                if (GameMain.GameSession.Mission.Completed && singleplayer)
                {
                    new GUITextBlock(new Rectangle(0, 0, 0, 30), "Reward: " + GameMain.GameSession.Mission.Reward, "", Alignment.BottomLeft, Alignment.BottomLeft, innerFrame);
                }
            }

            return(frame);
        }
Esempio n. 7
0
        private static void DrawStatusIcons(SpriteBatch spriteBatch, Character character)
        {
            if (GameMain.DebugDraw)
            {
                GUI.DrawString(spriteBatch, new Vector2(30, GameMain.GraphicsHeight - 260), "Stun: " + character.Stun, Color.White);
            }

            if (oxygenBar == null)
            {
                int width = 100, height = 20;

                oxygenBar = new GUIProgressBar(new Rectangle(30, GameMain.GraphicsHeight - 200, width, height), Color.Blue, "", 1.0f, Alignment.TopLeft);
                new GUIImage(new Rectangle(-27, -7, 20, 20), new Rectangle(17, 0, 20, 24), statusIcons, Alignment.TopLeft, oxygenBar);

                healthBar = new GUIProgressBar(new Rectangle(30, GameMain.GraphicsHeight - 230, width, height), Color.Red, "", 1.0f, Alignment.TopLeft);
                new GUIImage(new Rectangle(-26, -7, 20, 20), new Rectangle(0, 0, 13, 24), statusIcons, Alignment.TopLeft, healthBar);
            }

            oxygenBar.BarSize = character.Oxygen / 100.0f;
            if (oxygenBar.BarSize < 0.99f)
            {
                oxygenBar.Draw(spriteBatch);
                if (!oxyMsgShown)
                {
                    GUI.AddMessage(InfoTextManager.GetInfoText("OxygenBarInfo"), new Vector2(oxygenBar.Rect.Right + 10, oxygenBar.Rect.Y), Alignment.Left, Color.White, 5.0f);
                    oxyMsgShown = true;
                }
            }

            healthBar.BarSize = character.Health / character.MaxHealth;
            if (healthBar.BarSize < 1.0f)
            {
                healthBar.Draw(spriteBatch);
            }

            float bloodDropCount = character.Bleeding;

            bloodDropCount = MathHelper.Clamp(bloodDropCount, 0.0f, 5.0f);
            for (int i = 0; i < Math.Ceiling(bloodDropCount); i++)
            {
                float alpha = MathHelper.Clamp(bloodDropCount - i, 0.2f, 1.0f);
                spriteBatch.Draw(statusIcons.Texture, new Vector2(25.0f + 20 * i, healthBar.Rect.Y - 20.0f), new Rectangle(39, 3, 15, 19), Color.White * alpha);
            }

            float pressureFactor = (character.AnimController.CurrentHull == null) ?
                                   100.0f : Math.Min(character.AnimController.CurrentHull.LethalPressure, 100.0f);

            if (character.PressureProtection > 0.0f)
            {
                pressureFactor = 0.0f;
            }

            if (pressureFactor > 0.0f)
            {
                float indicatorAlpha = ((float)Math.Sin(character.PressureTimer * 0.1f) + 1.0f) * 0.5f;
                indicatorAlpha = MathHelper.Clamp(indicatorAlpha, 0.1f, pressureFactor / 100.0f);

                if (indicatorAlpha > 0.1f)
                {
                    if (!pressureMsgShown)
                    {
                        GUI.AddMessage(InfoTextManager.GetInfoText("PressureInfo"), new Vector2(40.0f, healthBar.Rect.Y - 60.0f), Alignment.Left, Color.White, 5.0f);
                        pressureMsgShown = true;
                    }
                }

                spriteBatch.Draw(statusIcons.Texture, new Vector2(10.0f, healthBar.Rect.Y - 60.0f), new Rectangle(0, 24, 24, 25), Color.White * indicatorAlpha);
            }
        }