Esempio n. 1
0
    // Use this for initialization
    void Awake()
    {
        _player              = FindObjectOfType <Player>();
        _playerAutoAim       = _player.GetComponent <AutoAim>();
        _playerLaser         = _player.GetComponent <LaserWeapon>();
        _playerMissile       = _player.GetComponent <MissileWeapon>();
        _playerShieldManager = _player.GetComponent <ShieldManager>();

        InvokeRepeating("WaitingCom", 0, 1);
    }
Esempio n. 2
0
    void Start()
    {
        if (Camera.main != null)
        {
            mainCamera = Camera.main.transform;
        }

        if (GameManager.Instance.Player != null)
        {
            playerController = GameManager.Instance.Player;
        }

        if (playerController != null)
        {
            weaponController = playerController.GetComponent <WeaponController> ();
            autoAim          = playerController.GetComponent <AutoAim> ();
        }

        if (GameManagerUI.Instance != null)
        {
            GameManagerUI.Instance.SetMobileControlsActive(false);
            IsMobile = false;
            if (AutoMobileDetection)
            {
                                #if UNITY_ANDROID || UNITY_IPHONE
                GameManagerUI.Instance.SetMobileControlsActive(true);
                IsMobile = true;
                                #endif
            }
            if (ForcedMode == InputForcedMode.Mobile)
            {
                GameManagerUI.Instance.SetMobileControlsActive(true);
                IsMobile = true;
            }
            if (ForcedMode == InputForcedMode.Desktop)
            {
                GameManagerUI.Instance.SetMobileControlsActive(false);
                IsMobile = false;
            }
        }
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
#if !UNITY_EDITOR
        m_xboxController = new ControllerInput(0, 0.19f);
#endif
        m_gunAudioSource   = GetComponent <AudioSource>();
        m_rotorAudioSource = transform.Find("RotorSound").gameObject.GetComponent <AudioSource>();
        SetControlMode(ControlMode.Program);
        ChangeRotorSpeed(ref m_rotorSpeedCoroutine, "RotorSpeed", 3, 0);
        m_gunLastFired  = Time.time;
        m_targetForward = transform.forward;

        // Find muzzle and auto aim component
        m_autoAim = GetComponentInChildren <AutoAim>();
        Transform[] transforms = GetComponentsInChildren <Transform>();
        foreach (Transform xform in transforms)
        {
            if (xform.name == "Muzzle")
            {
                m_muzzleTransform = xform;
            }
        }
    }
Esempio n. 4
0
 void Reset()
 {
     autoAim      = FindObjectOfType <AutoAim>();
     playerCamera = Camera.main;
 }
Esempio n. 5
0
 protected virtual void Awake()
 {
     Autoaim = GetComponent <AutoAim>();
     Manager = FindObjectOfType <UIManager>();
 }
Esempio n. 6
0
 void Start()
 {
     _autoAim = GetComponentInParent <AutoAim>();
 }