Exemplo n.º 1
0
    public void ShootBullet()
    {
        Bullet instantiated = Instantiate(bullet, transform.position, Quaternion.identity, bulletHolder.transform);

        instantiated.speed     = bulletSpeed;
        instantiated.direction = bulletDirection;
        instantiated.team      = ishootable.GetTeam();
        instantiated.enabled   = true;
    }
Exemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        IShootable shootable = other.GetComponent <IShootable>();

        if (shootable != null)
        {
            if (shootable.GetTeam() != team)
            {
                animator.SetTrigger(Hit);
                shootable.OnShot(this);
            }

            return;
        }

        speed = 0;
        animator.SetTrigger(Hit);
    }