/// <summary> /// Trigger the symptom for a specific stage. /// </summary> /// <param name="asyncSymptom">The symptom to be applied (including player reference and such)</param> private void TriggerStageSymptom(SymptomManifestation symptomManifestation) { // Sometimes, the symptom get queued before the player dies and is unqueud when the player is dead/unconcious. // This prevents the symptom to be shown. if (symptomManifestation.MobHealth.ConsciousState >= ConsciousState.UNCONSCIOUS) { return; } switch (symptomManifestation.SicknessAffliction.Sickness.SicknessStages[symptomManifestation.Stage].Symptom) { case SymptomType.Wellbeing: PerformSymptomWellbeing(symptomManifestation); break; case SymptomType.Immune: PerformSymptomImmune(symptomManifestation); break; case SymptomType.Cough: PerformSymptomCough(symptomManifestation); break; case SymptomType.Sneeze: PerformSymptomSneeze(symptomManifestation); break; case SymptomType.CustomMessage: PerformSymptomCustomMessage(symptomManifestation); break; } }
/// <summary> /// Trigger the symptom for a specific stage. /// </summary> /// <param name="asyncSymptom">The symptom to be applied (including player reference and such)</param> private void TriggerStageSymptom(SymptomManifestation symptomManifestation) { switch (symptomManifestation.SicknessAffliction.Sickness.SicknessStages[symptomManifestation.Stage].Symptom) { case SymptomType.Wellbeing: PerformSymptomWellbeing(symptomManifestation); break; case SymptomType.Immune: PerformSymptomImmune(symptomManifestation); break; case SymptomType.Cough: PerformSymptomCough(symptomManifestation); break; case SymptomType.Sneeze: PerformSymptomSneeze(symptomManifestation); break; case SymptomType.CustomMessage: PerformSymptomCustomMessage(symptomManifestation); break; } }
private void SpawnContagionSpot(SymptomManifestation symptomManifestation, Vector3 position) { SpawnResult spawnResult = Spawn.ServerPrefab(contagionPrefab, position, null, null, 1, null, true); if (spawnResult.Successful) { spawnResult.GameObject.GetComponent <Contagion>().Sickness = symptomManifestation.SicknessAffliction.Sickness; } }
/// <summary> /// Perform the sneeze symptom for afflicted player. /// </summary> private void PerformSymptomCough(SymptomManifestation symptomManifestation) { GameObject performer = symptomManifestation.MobHealth.gameObject; Chat.AddActionMsgToChat(performer, "You cough.", $"{performer.ExpensiveName()} coughs!"); if (symptomManifestation.SicknessAffliction.Sickness.Contagious) { SpawnContagion(symptomManifestation); } }
/// <summary> /// Perform the sneeze symptom for afflicted player. /// </summary> private void PerformSymptomSneeze(SymptomManifestation symptomManifestation) { GameObject performer = symptomManifestation.PlayerHealth.gameObject; Chat.AddActionMsgToChat(performer, "You sneeze.", $"{performer.name} sneezes"); if (symptomManifestation.SicknessAffliction.Sickness.Contagious) { SpawnContagion(symptomManifestation); } }
/// <summary> /// This will spawn a contagion spot with the specific sickness in it /// at the player position and in the 3 spots in front of him. /// Like so: /// o /// xo /// o /// </summary> /// <param name="symptomManifestation"></param> private void SpawnContagion(SymptomManifestation symptomManifestation) { Vector3Int position = symptomManifestation.PlayerHealth.gameObject.RegisterTile().WorldPositionServer; Directional playerDirectional = symptomManifestation.PlayerHealth.PlayerMove.PlayerDirectional; // Player position SpawnContagionSpot(symptomManifestation, position); // In front SpawnContagionSpot(symptomManifestation, position + playerDirectional.CurrentDirection.Vector); // Front left SpawnContagionSpot(symptomManifestation, position + (Quaternion.Euler(0, 0, -45) * playerDirectional.CurrentDirection.Vector)); // Front Right SpawnContagionSpot(symptomManifestation, position + (Quaternion.Euler(0, 0, 45) * playerDirectional.CurrentDirection.Vector)); }
/// <summary> /// Perform the custom message symptom. /// This will spawn a random message for the affected player and perhaps it's public counterpart for the observers /// </summary> private void PerformSymptomCustomMessage(SymptomManifestation symptomManifestation) { GameObject performer = symptomManifestation.PlayerHealth.gameObject; CustomMessageParameter customMessageParameter = (CustomMessageParameter)symptomManifestation.SicknessAffliction.Sickness.SicknessStages[symptomManifestation.Stage].ExtendedSymptomParameters; int randomMessage = Random.Range(0, customMessageParameter.CustomMessages.Count); CustomMessage customMessage = customMessageParameter.CustomMessages[randomMessage]; string privateMessage = (customMessage.privateMessage ?? "").Replace("%PLAYERNAME%", performer.name); string publicMessage = (customMessage.publicMessage ?? "").Replace("%PLAYERNAME%", performer.name); if (string.IsNullOrWhiteSpace(publicMessage)) { Chat.AddExamineMsg(performer, privateMessage); } else { Chat.AddActionMsgToChat(performer, privateMessage, publicMessage); } }
/// <summary> /// This will spawn a contagion spot with the specific sickness in it /// at the player position and in the 3 spots in front of him. /// Like so: /// o /// xo /// o /// </summary> /// <param name="symptomManifestation"></param> private void SpawnContagion(SymptomManifestation symptomManifestation) { Vector3Int position = symptomManifestation.MobHealth.gameObject.RegisterTile().WorldPositionServer; Directional directional = symptomManifestation.MobHealth.GetComponent <Directional>(); // Player position SpawnContagionSpot(symptomManifestation, position); if (directional == null) { return; } // In front SpawnContagionSpot(symptomManifestation, position + directional.CurrentDirection.Vector); // Front left SpawnContagionSpot(symptomManifestation, position + (Quaternion.Euler(0, 0, -45) * directional.CurrentDirection.Vector)); // Front Right SpawnContagionSpot(symptomManifestation, position + (Quaternion.Euler(0, 0, 45) * directional.CurrentDirection.Vector)); }
/// <summary> /// This will remove the sickness from the player, healing him. This will also make him immune for the current round. /// </summary> private void PerformSymptomImmune(SymptomManifestation symptomManifestation) { symptomManifestation.MobHealth.ImmuneSickness(symptomManifestation.SicknessAffliction.Sickness); }
/// <summary> /// This will remove the sickness from the player, healing him. /// </summary> private void PerformSymptomWellbeing(SymptomManifestation symptomManifestation) { symptomManifestation.MobHealth.RemoveSickness(symptomManifestation.SicknessAffliction.Sickness); }