예제 #1
0
    // Update is called once per frame
    void Update()
    {
        //Trigger Value
        m_device = SteamVR_Controller.Input((int)m_trackedObject.index);

        //Trigger down
        if (m_device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger))
        {
            m_pistol.Fire();
        }

        //Trigger up
        if (m_device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger))
        {
            m_pistol.FireRelease();
        }

        //Grip button
        if (m_device.GetPress(SteamVR_Controller.ButtonMask.Grip))
        {
            StartCoroutine(m_pistol.Reload());
        }

        //Set Trigger
        Vector2 triggerValue = m_device.GetAxis(EVRButtonId.k_EButton_SteamVR_Trigger);

        m_pistol.SetTriggerRotation(triggerValue.x);
    }
예제 #2
0
    void FireByIndex()
    {
        switch (enemyType)
        {
        case 0:
            br.Fire();
            break;

        case 1:
            ps.Fire();
            break;

        case 2:
            sg.Fire();
            break;
        }
    }
예제 #3
0
        static void Main(string[] args)
        {
            Firearm firearm = new Firearm();

            firearm.Fire("I'm a generic firearm and I shoot things.");

            Shotgun shotgun = new Shotgun();

            shotgun.Fire("I'm a 12 guage shotgun and I got boom!");

            Pistol pistol = new Pistol();

            pistol.Fire("I'm a 9mm pistol and I got pop!");

            Rifle rifle = new Rifle();

            rifle.Fire("I'm a 30-06 rifle and I go crack!");
        }
예제 #4
0
        public static void Main(string[] args)
        {
            var gun = new Pistol("asd");

            for (int i = 0; i < 11; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    gun.Fire();
                }
            }

            Console.WriteLine(gun.CanFire);
            Console.WriteLine(gun.BulletsPerBarrel);
            Console.WriteLine(gun.TotalBullets);

            var player = new MainPlayer();

            player.TakeLifePoints(10);
            Console.WriteLine(player.IsAlive);
            Console.WriteLine(player.LifePoints);
        }
예제 #5
0
 public void Fire()
 {
     playerGun.Fire();
 }