Example #1
0
 protected virtual void OnDead(CauseOfDeath cause)
 {
     if (this.Dead != null)
     {
         this.Dead(this, new DeadBeanArgs(cause));
     }
 }
Example #2
0
    public void Die(CauseOfDeath cause = CauseOfDeath.Fell)
    {
        if (feeling == BoxyFeeling.Dead)
        {
            return;
        }

        feeling = BoxyFeeling.Dead;
        PlayerPrefs.SetInt("CauseOfDeath", (int)cause);
        RagDollMe();
        restartedSinceLastDeath = false;

        if (PlayerPrefs.GetInt("HasDiedByHavingTwo") == 1)
        {
            Invoke("RestartLevel", 1f);
        }
        else if (cause == CauseOfDeath.HadTwo)
        {
            // allow text animation to play before resetting
            Invoke("SetDiedFlag", maxTextAnimTime);
        }
        else                            // cause == CauseOfDeath.Fell
        {
            Invoke("RestartLevel", 1f); // simple restart, like the first condition
        }

        PlayClip(deathSfx);
    }
Example #3
0
    public void Die(CauseOfDeath causeOfDeath, Vector3 damagePosition = default, Collider2D collider = null)
    {
        ParticleSystem ps = Instantiate(bloodParticleSystem_Prefab);

        ps.transform.position = damagePosition;
        Destroy(gameObject);
    }
Example #4
0
 public void Die(Settlement.Settlement settlement, CauseOfDeath causeOfDeath)
 {
     Relationships.ForEach(rel => rel.Other(this).NotifyDeath(rel));
     settlement.SettlerManager.Settlers.Remove(this);
     settlement.SettlerManager.Graveyard.Add(this);
     settlement.AddMessage(new SettlerDeathMessage(this, causeOfDeath));
 }
    void Start()
    {
        CauseOfDeath cod = FindObjectOfType <CauseOfDeath>();

        switch (cod.cause)
        {
        case 1:
            //Hypothermia
            CauseOfDeathText = GameObject.Find("CauseOfDeathText");
            CauseOfDeathText.GetComponent <TextMeshProUGUI>().text = "Hypothermia";
            GameObject.Find("HypothermiaTip").GetComponent <TextMeshProUGUI>().enabled = true;
            break;

        case 2:
            //Asphyxia
            CauseOfDeathText = GameObject.Find("CauseOfDeathText");
            CauseOfDeathText.GetComponent <TextMeshProUGUI>().text = "Asphyxia";
            GameObject.Find("AsphyxiaTip").GetComponent <TextMeshProUGUI>().enabled = true;
            break;

        case 3:
            //Asphyxia
            CauseOfDeathText = GameObject.Find("CauseOfDeathText");
            CauseOfDeathText.GetComponent <TextMeshProUGUI>().text = "Starvation";
            GameObject.Find("StarvationTip").GetComponent <TextMeshProUGUI>().enabled = true;
            break;

        default:
            //Testing
            CauseOfDeathText = GameObject.Find("CauseOfDeathText");
            CauseOfDeathText.GetComponent <TextMeshProUGUI>().text = "Testing";
            GameObject.Find("TestingTip").GetComponent <TextMeshProUGUI>().enabled = true;
            break;
        }
    }
Example #6
0
        private List <Level.Event> RemoveGridItems(CauseOfDeath reason, List <GridNodeState> removedItems)
        {
            List <Level.Event> gridUpdateEvents = new List <Level.Event>();

            // record the event
            var destroyedEvent = new Level.ItemsDestroyedEvent(reason, removedItems);

            gridUpdateEvents.Add(destroyedEvent);

            // remove the items from the grid
            foreach (var node in removedItems)
            {
                node.RemoveItem();
            }

            // fix the grid until it ain't broke no more
            bool didUpdate;

            do
            {
                didUpdate = UpdateGridState(ref gridUpdateEvents);
            } while (didUpdate);

            return(gridUpdateEvents);
        }
Example #7
0
 protected virtual void Die(CauseOfDeath cause)
 {
     if (!dead)
     {
         Environment.Instance.DecreaseEntityPopulation(Species);
         dead = true;
     }
 }
Example #8
0
 protected virtual void Die(CauseOfDeath cause)
 {
     if (!dead)
     {
         dead = true;
         Environment.RegisterDeath(this);
         Destroy(gameObject);
     }
 }
Example #9
0
 public void Die(CauseOfDeath cause)
 {
     if (!dead)
     {
         dead = true;
         //Something.log(cause);
         //Environment.RegisterDeath (this);
         //Destroy (gameObject);
     }
 }
Example #10
0
 protected virtual void Die(CauseOfDeath cause)
 {
     if (!dead)
     {
         dead = true;
         Debug.Log(species.ToString() + " died, " + cause.ToString());
         Environment.RegisterDeath(this);
         Destroy(gameObject);
     }
 }
Example #11
0
 /// <summary>
 /// Kills a player in the Player list by their name. Returns a boolean to confirm the kill.
 /// </summary>
 /// <param name="PlayerName">Player name string (exact match needed)</param>
 /// <param name="_CauseOfDeath">Cause of the players death</param>
 /// <returns></returns>
 public bool KillPlayer(string PlayerName, CauseOfDeath _CauseOfDeath)
 {
     if (PlayersList.Any(x => x.Name.Trim().ToLower() == PlayerName.Trim().ToLower()))
     {
         var Player = PlayersList.Where(x => x.Name.Trim().ToLower() == PlayerName.Trim().ToLower()).First();
         Player.IsAlive      = false;
         Player.CauseOfDeath = _CauseOfDeath;
         return(true);
     }
     return(false);
 }
Example #12
0
        public ActionResult UpdateCod(int jID, string jName)
        {
            using (CGPEntities dt = new CGPEntities())
            {
                int          t = CurrentContext.GetCurrentTree();
                CauseOfDeath m = dt.CauseOfDeaths.Where(j => j.TreeID == t && j.CauseOfDeathID == jID).FirstOrDefault();
                m.CauseOfDeathText = jName;

                dt.SaveChanges();
                return(Json(m, JsonRequestBehavior.AllowGet));
            }
        }
Example #13
0
        /// <summary>
        /// Checks for game logic and then kills a character.
        /// This runs checks for:
        ///     - Scarlet Woman
        /// </summary>
        /// <param name="player"></param>
        /// <param name="causeOfDeath"></param>
        public void KillPlayer(Player player, CauseOfDeath causeOfDeath)
        {
            //If the Demon dies and there is an alive Scarlet Woman and there is 5 or more non traveller players change the scarlet woman to the demon
            if (Players.PlayersList.Where(x => x.IsAlive && x.Role.Type != RoleType.Traveller).Count() >= 5 &&
                player.Role.Type == RoleType.Demon &&
                Players.PlayersList.Any(x => x.Role.Name == "Scarlet Woman" && x.IsAlive))
            {
                Players.PlayersList.Where(x => x.Role.Name == "Scarlet Woman" && x.IsAlive).First().ChangeRole(player.Role);
            }

            player.KillPlayer(causeOfDeath, CurrentDay);
        }
Example #14
0
 public void Harm(int amount, Settlement.Settlement settlement, CauseOfDeath causeOfDeath)
 {
     if (amount < 0)
     {
         throw new ArgumentException("Harm only takes positive integers!");
     }
     Health -= amount;
     if (Health < 0)
     {
         Health = 0;
         Die(settlement, causeOfDeath);
     }
 }
Example #15
0
    public void ShowFinishPanel(CauseOfDeath cause)
    {
        foreach (DeathPhrases dp in deathPhrases)
        {
            if (dp.cause == cause)
            {
                causeOfDeath.text = dp.phrases[Random.Range(0, dp.phrases.Count)];
                break;
            }
        }

        finishPanel.gameObject.SetActive(true);
    }
Example #16
0
 public void PlayDeathClip(CauseOfDeath cause)
 {
     audioSource.Stop();
     foreach (DeathClip dc in deathClips)
     {
         if (dc.cause == cause)
         {
             audioSource.clip = dc.clip;
             audioSource.Play();
             break;
         }
     }
 }
Example #17
0
 public virtual void Die(CauseOfDeath cause)
 {
     if (!dead)
     {
         dead = true;
         Environment.RegisterDeath(this);
         Environment.objectPools[species].Return(this);
         //Destroy (gameObject);
         //Environment.AddDeath(species, cause);
     }
     else
     {
     }
 }
Example #18
0
    /// <summary>
    /// Kills the player
    /// </summary>
    public void Kill(CauseOfDeath cause)
    {
        //Do not kill a player in god mode
        if (GameState.GodMode && cause != CauseOfDeath.GiveUp)
        {
            return;
        }


        Alive = false;


        GameState.Events.OnPlayerKilled.Invoke(this, cause);
        UIManager.SetTitles("You Died!", _deathMessages[cause], Color.red, _deathColor[cause]);
    }
    public void Kill(CauseOfDeath causeOfDeath)
    {
        if (!alive)
        {
            return;
        }

        alive = false;

        if (causeOfDeath == CauseOfDeath.Falling)
        {
            transform.localScale = new Vector2(1.0f, 1.0f);
        }

        // Do something I guess
        PlayerDeath.Invoke();
    }
Example #20
0
    public void FinishGame(CauseOfDeath cause)
    {
        if (!gameFinished)
        {
            gameFinished = true;

            if (cause != CauseOfDeath.VICTORY)
            {
                GetComponent <MusicController>().PlayDeathClip(cause);
            }

            AudioListener.pause = true;
            Time.timeScale      = 0;
            Cursor.visible      = true;
            Cursor.lockState    = CursorLockMode.None;
            canvasController.ShowFinishPanel(cause);
        }
    }
Example #21
0
    public void Die(CauseOfDeath cause)
    {
        //register death;

        //add back to pool;
        // gameObject.SetActive(false);
        Debug.Log("Rabbit died of: " + cause);
        ObjectPooler.Instance.AddToPool(tag, gameObject);
        if (tag == "rabbit")
        {
            World.instance.actualRabbitAmount--;
        }
        if (tag == "wolf")
        {
            World.instance.actualWolfAmount--;
        }
        World.instance.UpdateUI();
    }
Example #22
0
 public ActionResult AddCod(string jName)
 {
     using (CGPEntities ctx = new CGPEntities())
     {
         try
         {
             CauseOfDeath b = new CauseOfDeath();
             b.CauseOfDeathText = jName;
             b.TreeID           = CurrentContext.GetCurrentTree();
             ctx.CauseOfDeaths.Add(b);
             ctx.SaveChanges();
             return(Json("Thêm Thành Công !", JsonRequestBehavior.AllowGet));
         }
         catch (Exception ex)
         {
             return(Json(ex.Message, JsonRequestBehavior.AllowGet));
         }
     }
 }
Example #23
0
        private bool IsDead(CauseOfDeath cause, int countdown, bool shouldDie)
        {
            if (shouldDie)
            {
                _dyingCounters[cause]++;

                if (_dyingCounters[cause] > countdown)
                {
                    OnDead(cause);
                    return(true);
                }
            }
            else
            {
                _dyingCounters[cause] = 0;
            }

            return(false);
        }
    protected virtual void Die(CauseOfDeath causeOfDeath)
    {
        _audioSource.PlayOneShot(_audioData.DeathAudioClips[Random.Range(0, _audioData.DeathAudioClips.Length - 1)]);

        switch (causeOfDeath)
        {
        case CauseOfDeath.Damage:
            _animator.SetTrigger("DamageDeath");
            break;

        case CauseOfDeath.HeartAttack:
            _animator.SetTrigger("HeartAttackDeath");
            break;

        case CauseOfDeath.Suspicious:
            _animator.SetTrigger("SuspicionDeath");
            break;
        }

        GameStateManager.SetGameState(GameState.GameOver);
    }
Example #25
0
    public void Die(CauseOfDeath causeOfDeath, Vector3 damagePosition, Collider2D collider)
    {
        if (!IsDead)
        {
            IsDead = true;
            DisableFists(GetComponent <Player>().RFistMovements, player.LFistMovements);
        }
        switch (causeOfDeath)
        {
        case CauseOfDeath.Spikes:
            DieFromSpikes(damagePosition, collider);
            break;

        case CauseOfDeath.SpikeWheel:
            DieFromSpikeWheel(damagePosition, collider);
            break;

        case CauseOfDeath.FellOutOfMap:
            DieFromSpikeWheel(collider.transform.position, collider);
            break;
        }
    }
Example #26
0
    protected override void Die(CauseOfDeath cause)
    {
        if (!dead)
        {
            RemoveFromLists();

            if (anim)
            {
                anim.SetTrigger("die");
            }

            if (cause == CauseOfDeath.Eaten)
            {
                StartCoroutine(FadeOutRoutine());
            }
            else
            {
                StartCoroutine(FloatToWaterSurface());
            }
        }

        base.Die(cause);
    }
Example #27
0
    new void Die(CauseOfDeath cause)
    {
        if (!dead)
        {
            dead = true;
            Debug.Log(species.ToString() + " died, " + cause.ToString());
            Environment.RegisterDeath(this);

            if (animatingMovement)
            {
                animatingMovement  = false;
                transform.position = moveTargetPos;
                coord = moveTargetCoord;
            }
            float rotx = transform.eulerAngles.x;
            float roty = transform.eulerAngles.y;
            transform.eulerAngles = new Vector3(rotx, roty, 90);

            var ded = gameObject.AddComponent(typeof(DeadAnimal)) as DeadAnimal;
            ded.Init(this);
            DestroyImmediate(this);
        }
    }
Example #28
0
 protected virtual void OnDead(CauseOfDeath cause)
 {
     if (this.Dead != null)
     {
         this.Dead(this, new DeadBeanArgs(cause));
     }
 }
Example #29
0
        private bool IsDead(CauseOfDeath cause, int countdown, bool shouldDie)
        {
            if (shouldDie)
            {
                _dyingCounters[cause]++;

                if (_dyingCounters[cause] > countdown)
                {
                    OnDead(cause);
                    return true;
                }
            }
            else
            {
                _dyingCounters[cause] = 0;
            }

            return false;
        }
Example #30
0
 public DeadBeanArgs(CauseOfDeath cause)
 {
     this.Cause = cause;
 }
Example #31
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator),
                       Id,
                       EventIdentifiersUsed != null ? string.Join(Configuration.FieldRepeatSeparator, EventIdentifiersUsed.Select(x => x.ToDelimitedString())) : null,
                       EventSymptomDiagnosisCode != null ? string.Join(Configuration.FieldRepeatSeparator, EventSymptomDiagnosisCode.Select(x => x.ToDelimitedString())) : null,
                       EventOnsetDateTime.HasValue ? EventOnsetDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       EventExacerbationDateTime.HasValue ? EventExacerbationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       EventImprovedDateTime.HasValue ? EventImprovedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       EventEndedDataTime.HasValue ? EventEndedDataTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       EventLocationOccurredAddress != null ? string.Join(Configuration.FieldRepeatSeparator, EventLocationOccurredAddress.Select(x => x.ToDelimitedString())) : null,
                       EventQualification != null ? string.Join(Configuration.FieldRepeatSeparator, EventQualification) : null,
                       EventSerious,
                       EventExpected,
                       EventOutcome != null ? string.Join(Configuration.FieldRepeatSeparator, EventOutcome) : null,
                       PatientOutcome,
                       EventDescriptionFromOthers != null ? string.Join(Configuration.FieldRepeatSeparator, EventDescriptionFromOthers) : null,
                       EventDescriptionFromOriginalReporter != null ? string.Join(Configuration.FieldRepeatSeparator, EventDescriptionFromOriginalReporter) : null,
                       EventDescriptionFromPatient != null ? string.Join(Configuration.FieldRepeatSeparator, EventDescriptionFromPatient) : null,
                       EventDescriptionFromPractitioner != null ? string.Join(Configuration.FieldRepeatSeparator, EventDescriptionFromPractitioner) : null,
                       EventDescriptionFromAutopsy != null ? string.Join(Configuration.FieldRepeatSeparator, EventDescriptionFromAutopsy) : null,
                       CauseOfDeath != null ? string.Join(Configuration.FieldRepeatSeparator, CauseOfDeath.Select(x => x.ToDelimitedString())) : null,
                       PrimaryObserverName != null ? string.Join(Configuration.FieldRepeatSeparator, PrimaryObserverName.Select(x => x.ToDelimitedString())) : null,
                       PrimaryObserverAddress != null ? string.Join(Configuration.FieldRepeatSeparator, PrimaryObserverAddress.Select(x => x.ToDelimitedString())) : null,
                       PrimaryObserverTelephone != null ? string.Join(Configuration.FieldRepeatSeparator, PrimaryObserverTelephone.Select(x => x.ToDelimitedString())) : null,
                       PrimaryObserversQualification,
                       ConfirmationProvidedBy,
                       PrimaryObserverAwareDateTime.HasValue ? PrimaryObserverAwareDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       PrimaryObserversIdentityMayBeDivulged
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Example #32
0
 public ItemsDestroyedEvent(CauseOfDeath reason, List <GridNodeState> destroyedItems)
 {
     Reason         = reason;
     DestroyedItems = new List <GridEventItem>(destroyedItems.Select(item => GridEventItem.Create(item, 0)));
 }
    private void StartDeathSequence(CauseOfDeath causeOfDeath)
    {
        Dead = true;

        for (int i = 0; i < _colliders.Length; i++) { _colliders[i].enabled = false; }

        switch (causeOfDeath)
        {
            case CauseOfDeath.Generic: PlayGenericDeathAnimation(); break;
            case CauseOfDeath.FellIntoLava: PlayLavaDeathEffect(); break;
            case CauseOfDeath.FellOutOfLevel: SoundEffectManager.PlaySound("Death"); break;
        }

        GameOverPopup.SetActive(true);
    }
	private IEnumerator ShowContinueScreen(float waitTime, CauseOfDeath causeOfDeath)
	{
		if(OnGameEnding != null)
			OnGameEnding();

		isGameRunning = false;
		gameOver = true;
		player.SetActive (false);

		//fade out TimeScale
		lastTimeScale = Time.timeScale;
		float fadeEndTime = Time.realtimeSinceStartup + waitTime;
		while(Time.realtimeSinceStartup < fadeEndTime)
		{
			Time.timeScale = ((fadeEndTime - Time.realtimeSinceStartup) / waitTime) * lastTimeScale;
			yield return null;
		}
		
		Time.timeScale = 0;

		Debug.Log("ShowContinueScreen()");

		#if ADMOB_IMPLEMENTED
		Debug.Log(string.Format("AdMobHelper.IsRewardedVideoReady? {0}",AdMobHelper.IsRewardedVideoReady));
		if (continues == 0 && AdMobHelper.IsRewardedVideoReady)
			Popup.ShowVideoNo(Localization.Get(causeOfDeath.ToString()) + "\n \n" + Localization.Get("VIDEO_TO_PLAY"), ShowAdToContinue, ShowEndScreen, false);
		else
		{
		#endif
			#if INFINITY_ORBS
			Popup.ShowYesNo(Localization.Get(causeOfDeath.ToString()) + "\n \n" + Localization.Get("INFINITY_ORBS_TO_PLAY"), PayContinueOrbs, ShowEndScreen);
			#else
			float orbsToPay = (orbsToContinue * Mathf.Pow(2, continues));
			Debug.Log("orbsToPay: " + orbsToPay);
			if(Global.TotalOrbs >= orbsToPay)
				Popup.ShowYesNo(Localization.Get(causeOfDeath.ToString()) + "\n \n" + string.Format(Localization.Get ("WANT_TO_SPEND"), orbsToPay) + "\n \n (" + string.Format(Localization.Get ("YOU_HAVE"), Global.TotalOrbs) + ")", PayContinueOrbs, ShowEndScreen);
			else
				Popup.ShowOk(Localization.Get(causeOfDeath.ToString()) + "\n \n" + Localization.Get ("NOT_ENOUGH_ORBS"), ShowEndScreen);
			#endif
		#if ADMOB_IMPLEMENTED
		}
		#endif

		if (OnShowContinueScreen != null)
			OnShowContinueScreen ();
	}
Example #35
0
 protected virtual void Die(CauseOfDeath cause)
 {
     Destroy(gameObject);
 }