示例#1
0
 protected virtual void Die(CauseOfDeath cause)
 {
     if (!dead)
     {
         dead = true;
         Debug.Log(species.ToString() + " died, " + cause.ToString());
         Environment.RegisterDeath(this);
         Destroy(gameObject);
     }
 }
示例#2
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);
        }
    }
	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 ();
	}
示例#4
0
 static public void AddDeath(Species species, CauseOfDeath cause)
 {
     WriteString("death.txt", species.ToString() + " " + cause.ToString());
 }