Ejemplo n.º 1
0
 public void Update()
 {
     if (this.target != null && this.target.IsDestroyed())
     {
         this.target = null;
     }
     this.target = this.sight.Closest;
     if (this.target != null)
     {
         this.transform.rotation = Quaternion.Euler(new Vector3(0, 0, ((Vector2)this.target.Transform().position - (Vector2)this.transform.position).AngleWithVector2Up()));
     }
     this.shooter.shooting = this.target != null &&
                             Physics2D.Raycast(this.shooter.bulletSpawnPosition.position,
                                               this.target.Transform().position - this.shooter.bulletSpawnPosition.position,
                                               Vector2.Distance(this.target.Transform().position, this.transform.position), 1 << LayerMask.NameToLayer("TeamMember")).collider == null;
 }
Ejemplo n.º 2
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.isTrigger)
        {
            return;
        }
        if (collision.gameObject == this.ignoreCollision)
        {
            return;
        }
        IBulletDamageable colliderEffect = collision.GetComponent <IBulletDamageable>();

        if (colliderEffect != null)
        {
            colliderEffect.TakeBulletDamages(damage);
        }
        this.deathTime = Time.time;
    }