Exemplo n.º 1
0
 void Shoot()
 {
     if (Vector3.Distance(transform.position, player.position) > minDistance && Vector3.Distance(transform.position, player.position) < maxDistance)
     {
         RaycastHit2D hit = Physics2D.Raycast(transform.position, -transform.position - -player.position, Vector3.Distance(transform.position, player.position) - 1f, LayerMask.GetMask("Default"));
         if (hit.transform == null)
         {
             if (anim != null && anim.HasState(0, 0) == true)
             {
                 anim.Play(0);
             }
             if (parentShake != null)
             {
                 parentShake.MediumShake();
             }
             sound.SpawnEffect(shootSound, 0.2f, 1, 0, transform);
             transform.parent.localScale += Vector3.one / 3;
             GameObject g = Instantiate(toShoot, shootPivot.position, transform.rotation * toShoot.transform.rotation);
             if (transform.position.x < player.position.x)
             {
                 g.transform.localScale = new Vector3(g.transform.localScale.x, -g.transform.localScale.y, g.transform.localScale.z);
             }
         }
     }
 }
Exemplo n.º 2
0
 void TryToKill()
 {
     if (timeleft <= 0)
     {
         CancelInvoke("TryToKill");
         txt.text = "";
         toKill.hitEvent.Invoke(0);
     }
     else
     {
         transform.localScale += Vector3.one / 3;
         txt.text              = timeleft + "";
         timeleft--;
         flash.MediumShake();
     }
 }
Exemplo n.º 3
0
 public void MediumShake()
 {
     camShake.MediumShake();
 }