예제 #1
0
    public override void Impulse(ImpulseType type)
    {
        if (!m_Weapon)
        {
            m_Weapon = GetComponent <Shootable>();
        }

        if (m_Weapon)
        {
            Item weapon_item = GetComponent <Item>();
            FirstPersonMovementController movement_controller = (weapon_item && weapon_item.Owner ? weapon_item.Owner.GetComponent <FirstPersonMovementController>() : null);
            Transform camera_anchor = (movement_controller ? movement_controller.CameraAnchor : null);

            switch (type)
            {
            case ImpulseType.ATTACK:
                m_Weapon.Fire(camera_anchor);
                break;

            case ImpulseType.REFRESH:
                m_Weapon.Reload();
                break;

            default:
                base.Impulse(type);
                break;
            }
        }
    }
예제 #2
0
    protected virtual void FireRound(GameObject muzzle)
    {
        //get bullet from pool
        PooledObject bullet = ObjectPoolManager.Get(Projectile.gameObject);

        //get the actual bullet part from the bullet
        Shootable shootBase = bullet.gameObject.GetComponent <Shootable>();

        //actually shoot it
        shootBase.Fire(muzzle.transform.position, muzzle.transform.rotation, muzzle.transform.up, bullet);
        Source.Play();
    }