예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (getCooldown() <= 0 && Input.GetButtonDown("fireball"))
     {
         GameObject       ball   = GameObject.Instantiate(prototype, spawnPoint.position, spawnPoint.rotation);
         FireballMovement fbMove = ball.GetComponent <FireballMovement>();
         fbMove.Fire();
         lastFire = Time.time;
     }
 }
예제 #2
0
 // Check projectiles touching
 private void OnTriggerEnter2D(Collider2D collision)
 {
     // Check if it's an enemy projectile
     if (collision.gameObject.CompareTag("Projectile"))
     {
         // Get fireball fireballMovement identifier
         fireball = collision.gameObject.GetComponent <FireballMovement>();
         // If it's a tiny projectile
         if (fireball.identifier == 1)
         {
             if (canGetDamaged)
             {
                 camShake.ShakeCamera(0.2f, 0.2f);
                 Damage(1);
                 canGetDamaged = false;
             }
         }
         if (fireball.identifier == 2)
         {
             if (canGetDamaged)
             {
                 camShake.ShakeCamera(0.4f, 0.3f);
                 Damage(2);
                 canGetDamaged = false;
             }
         }
         // Destroy projectile
         fireball.Destruction(true);
         // Reset damage timer
         damageTimer = 0.7f;
     }
     if (collision.CompareTag("Ground") || collision.CompareTag("Wall"))
     {
         lives = 0;
         Kill();
     }
     if (collision.CompareTag("CeilingKiller"))
     {
         if (!MathPlayerMovement.instance.disableXInput)
         {
             lives = 0;
             Kill();
         }
     }
 }
예제 #3
0
    // Use this for initialization


    void Awake()
    {
        fireball = GetComponent <FireballMovement>();
    }