Пример #1
0
/*
 *  public void Observe(SlugEvents ev) {
 *      if (ev == SlugEvents.HitGround) {
 *          bounceCount++;
 *          ZRotationStepCurrent *= 2;
 *          if (bounceCount >= bouncesToExplode) {
 *              Explode();
 *          }
 *      }
 *  }
 */
    private void Explode(Collider2D col)
    {
        ProjectileUtils.ImpactAnimationAndSound(transform, col, properties);
        ProjectileUtils.NotifyCollider(col, properties);
        explosionWave.CastAOE("enemy", transform.position);
        gameObject.SetActive(false);
    }
Пример #2
0
 public void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == properties.victimTag)
     {
         ProjectileUtils.ImpactAnimationAndSound(transform, col, properties);
         ProjectileUtils.NotifyCollider(col, properties);
         gameObject.SetActive(false);
     }
 }
Пример #3
0
 private void Explode(Collider2D col)
 {
     explosion.gameObject.SetActive(true);
     explosion.transform.position = this.transform.position;
     explosion.Play("1");
     //ProjectileUtils.ImpactAnimationAndSound(transform, col, properties);
     ProjectileUtils.NotifyCollider(col, properties);
     gameObject.SetActive(false);
 }
Пример #4
0
    private void Explode(Collider2D col = null)
    {
        explosion.transform.position = this.transform.position;
        explosion.gameObject.SetActive(true);
        if (col != null)
        {
            ProjectileUtils.NotifyCollider(col, properties);
        }

        flash.ResetMaterial();
        gameObject.SetActive(false);
    }
Пример #5
0
 public void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Player")
     {
         if (properties.explosionAnimator != null)
         {
             ProjectileUtils.ImpactAnimationAndSound(transform, col, properties);
         }
         ProjectileUtils.NotifyCollider(col, properties);
         // NO WE DONT DO THAT FOR BREATH OR ANY AOE PROJ  gameObject.SetActive(false);
         // 2 types de proj se distingue les aoe (leurs effets dure sur la duree et sur un espace)
         // et les non aoe (bullets)
     }
 }
Пример #6
0
    public void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == properties.victimTag || col.tag == "World")
        {
            ProjectileUtils.RandomizeImpactPosition(transform, impactAnimator.transform);
            impactAnimator.gameObject.SetActive(true);
            if (col.tag == "World")
            {
                impactAnimator.transform.right = transform.right;
                impactAnimator.Play("2");
            }
            else
            {
                impactAnimator.Play("1");
                ProjectileUtils.NotifyCollider(col, properties);
            }

            gameObject.SetActive(false);
        }
    }
Пример #7
0
    public void CastAOE(string victimsTag, Vector2 pos)
    {
        Vector2 center = new Vector2(pos.x - transform.right.x * (boxSize.x / 2) + boxOffset.x * transform.right.x,
                                     pos.y - (boxSize.y / 2) + boxOffset.y);

        float duration = 1.5f;

        Debug.DrawLine(center, new Vector2(center.x, center.y + boxSize.y), Color.red, duration);
        Debug.DrawLine(center, new Vector2(center.x + boxSize.x * transform.right.x, center.y), Color.blue, duration);
        Debug.DrawLine(new Vector2(center.x + boxSize.x * transform.right.x, center.y),
                       new Vector2(center.x + boxSize.x * transform.right.x, center.y + boxSize.y), Color.cyan, duration);

        Vector2 centre = new Vector2(pos.x + boxOffset.x * transform.right.x, pos.y + boxOffset.y);

        RaycastHit2D[] hits = Physics2D.BoxCastAll(centre, boxSize, 0, transform.right, 0, layerMask);

        for (int i = 0; i < hits.Length; i++)
        {
            if (hits[i].collider.tag == victimsTag)
            {
                ProjectileUtils.NotifyCollider(hits[i].collider, projectileProp);
            }
        }
    }