예제 #1
0
 void RandomShootAi()
 {
     if (Time.time >= nextTriggerTime)
     {
         timeBetweenTrigger = RandomFireRate();
         nextTriggerTime    = Time.time + timeBetweenTrigger;
         myPooledShooting.TriggerShoot(Random.onUnitSphere);
     }
 }
예제 #2
0
 void RandomShootAi()
 {
     if (Time.time >= nextTriggerTime)
     {
         timeBetweenTrigger = RandomFireRate();
         nextTriggerTime    = Time.time + timeBetweenTrigger;
         if (HasValidLayerDistance())
         {
             myPooledShooting.TriggerShoot(Vector3.zero);
         }
     }
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (!readInput)
        {
            if (overrideInput)
            {
                m_Input     = overrideDirection;
                m_InputFire = overrideShoot;
            }
            return;
        }

#if UNITY_STANDALONE
        switch (standaloneInput)
        {
        case (StandaloneInput.Mouse): {
            m_Input.x = Input.GetAxis("Mouse X");
            m_Input.y = Input.GetAxis("Mouse Y");
            break;
        }

        case (StandaloneInput.Keyboard): {
            m_Input.x = CrossPlatformInputManager.GetAxis("Horizontal");
            m_Input.y = CrossPlatformInputManager.GetAxis("Vertical");
            break;
        }
        }
#endif
#if UNITY_ANDROID
        m_Input.x = CrossPlatformInputManager.GetAxis("Horizontal");
        m_Input.y = CrossPlatformInputManager.GetAxis("Vertical");
#endif

        m_InputFire = CrossPlatformInputManager.GetButton("Fire");

#if UNITY_STANDALONE
        switch (standaloneInput)
        {
        case (StandaloneInput.Mouse): {
            if (m_InputFire)
            {
                shootingPooled.TriggerShoot(rb2d.velocity);
            }
            break;
        }

        case (StandaloneInput.Keyboard): {
            if (m_InputFire)
            {
                shootingPooled.TriggerShoot(m_Input);
            }
            break;
        }
        }
#endif
#if UNITY_ANDROID
        if (m_InputFire)
        {
            shootingPooled.TriggerShoot(m_Input);
        }
#endif
    }