Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (!gameStarted)
        {
            return;
        }

        if (bunny.getHealth() <= 0)
        {
            SetGameOver();
        }

        time += Time.deltaTime;

        var currentHealth     = (float)bunny.getHealth();
        var currentBunnyState = Mathf.CeilToInt(currentHealth / Bunny.FullHealth * 5f);

        Debug.Log(string.Format("health: {0}, bunnyState: {1}", bunny.getHealth(), currentBunnyState));

        if (currentBunnyState != bunnyState)
        {
            bunnyState = currentBunnyState;

            AdjustBunnyState();
            AdjustWorldState();
        }
    }
Example #2
0
 void Update()
 {
     if (mainCam == null)
     {
         mainCam = Camera.main;
     }
     if (mainCam != null && colors != null && bunny != null)
     {
         mainCam.backgroundColor = colors.Evaluate(1 - bunny.getHealth() / 100.0f);
     }
 }
Example #3
0
//	private float

    void Update()
    {
        if (isBleeding)
        {
//			if (Time.time > nextBallTime){
//				SpawnBloodBall();
//				nextBallTime = Time.time + ballTimeInterval;
//			}
            if (Time.time > nextSpurtTime)
            {
                nextSpurtTime = Time.time + spurtInterval;

//				ParticleSystem.Burst burst = new ParticleSystem.Burst(Time.time, 10);
//				spurtSystem.emission.SetBursts(new ParticleSystem.Burst[]{burst});

                float bloodPower = 100f - bunny.getHealth() + 10f;

                spurtSystem.emissionRate = bloodPower;
                boostSystem.emissionRate = bloodPower;
//				ParticleSystem.EmissionModule emMod = spurtSystem.emission;
//				ParticleSystem.MinMaxCurve minMaxCurve = emMod.rate;
//				minMaxCurve.curveScalar =  100f - bunny.getHealth();
//
//				spurtSystem.emission = emMod;
////				emMod.rate.curveScalar = 100f - bunny.getHealth();
////				minMaxCurve.curveScalar = 100 - bunny.getHealth();
//				spurtSystem.emission.rate = minMaxCurve;

                Debug.Log("spurtSystem.emission.rate.curveScalar)");

                spurtSystem.Play();



                SpawnBloodBall(transform.forward, 4f, bloodPower);

//				spurtSystem.emission.SetBursts()
            }
        }
    }
Example #4
0
 public void ApplyEffect(Item item)
 {
     if (item.itemEffect == Effect.HEAL)
     {
         bunny.increaseHealth(item.amount);
     }
     if (item.itemEffect == Effect.SPEED)
     {
         StartCoroutine(SpeedPickup(item.amount));
     }
     if (item.itemEffect == Effect.REDUCEBLEED)
     {
         StartCoroutine(ReduceBleedSpeed(item.amount));
     }
     Debug.Log("Health: " + bunny.getHealth() + ", Speed: " + bunny.speed);
     item.gameObject.SetActive(false);
 }
    // Update is called once per frame
    void Update()
    {
//		Debug.Log("IsPlaying(\"bunny_die\"): " + IsPlaying("bunny_die") + ", BunnyScript.getHealth(): "+ BunnyScript.getHealth());
        if (BunnyScript.getHealth() <= 0)
        {
            return;
        }

        if (Input.GetKeyUp(KeyCode.K))
        {
            anim.Play("bunny_die");
        }
        if (IsPlaying("bunny_die"))
        {
            return;
        }

        if (BunnyScript.rb.velocity.x > 0)
        {
            sr.flipX = false;
        }
        else if (BunnyScript.rb.velocity.x < 0)
        {
            sr.flipX = true;
        }

        if (BunnyScript.isOnGround())
        {
            DoGroundAnimations();
        }
        else
        {
            if (BunnyScript.rb.velocity.y < 0)
            {
                anim.Play("bunny_jumpFall");
            }
        }
    }
Example #6
0
 // Update is called once per frame
 void Update()
 {
     healthBar.value = bunny.getHealth();
 }