コード例 #1
0
 void ExitMap()
 {
     if (!hasLeftMap)
     {
         audioManager.PlaySound("NPC_Escape");
         scoreController.AddToScore(gameObject.transform.position, 100);
         hasLeftMap = true;
     }
     Destroy(this.gameObject, 0.25f);
 }
コード例 #2
0
 public void Repair()
 {
     if (isBroken)
     {
         isBroken = false;
         scoreController.AddToScore(gameObject.transform.position, 50);
         audioManager.PlaySound("Repair");
         anim.SetBool("isBroken", false);
     }
 }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        if (isDamagingPlayer)
        {
            DamagePlayer(25f);
            audioManager.PlaySound("NPC_Death");
            isDamagingPlayer = false;
        }

        if (isPickingExtinguisher)
        {
            extinguisherFuel += 100f;
            if (extinguisherFuel > 100f)
            {
                extinguisherFuel = 100f;
            }
            audioManager.PlaySound("Pickup");
            extinguisherBar.SetSliderValue(extinguisherFuel);
            isPickingExtinguisher = false;
        }

        if (isDestroyingRock)
        {
            isDestroyingRock = false;
            scoreController.AddToScore(gameObject.transform.position, 50);
            audioManager.PlaySound("Explosion");
        }

        if (isRepairingItem)
        {
            isRepairingItem = false;
        }

        if (health <= 0)
        {
            DiePlayer();
        }

        if (!isUsingUmbrella)
        {
            if (umbrellaCharge > 100f)
            {
                umbrellaCharge = 100f;
            }
            else
            {
                umbrellaCharge++;
                umbrellaBar.SetSliderValue(umbrellaCharge);
            }
        }

        // keyR.SetActive(false);

        // Debug.Log("Umbrella Charge: " + umbrellaCharge);
    }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        if (health <= 0f)
        {
            DestroyFire();
        }

        if (isDestroyingFire)
        {
            isDestroyingFire = false;
            scoreController.AddToScore(gameObject.transform.position, 75);
        }
    }
コード例 #5
0
 // When the ball collides with a wall
 private void OnCollisionEnter2D(Collision2D collision)
 {
     // Add one to the score
     ScoreController.AddToScore(1);
 }