Пример #1
0
    void Start()
    {
        // set layer weights
        avatar = GetComponent <Animator> ();
        avatar.SetLayerWeight(1, 0);


        joysticks     = FindObjectsOfType <CNJoystick>() as CNJoystick [];
        joystickRight = joysticks [0];
        joystickLeft  = joysticks [1];

        if (!character)
        {
            character = transform;
        }

        if (!motor)
        {
            motor = GetComponent <ShooterMovementMotor> ();
        }

        motor.movementDirection = Vector3.zero;
        motor.facingDirection   = Vector3.zero;


        // Make the rigid body not change rotation
        if (GetComponent <Rigidbody>())
        {
            GetComponent <Rigidbody>().freezeRotation = true;
        }
    }
Пример #2
0
    // Use this for initialization
    void Awake()
    {
        charController      = GetComponent <CharacterController>();
        cameraRelativeSetup = GetComponent <CNCameraRelativeSetup>();
        joystick            = cameraRelativeSetup.joystick;

        joystick.JoystickMovedEvent += AnimateMovement;
        joystick.FingerLiftedEvent  += StoppedMoving;
    }
Пример #3
0
    void Awake()
    {
#if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8
        if (m_photonView.isMine)
        {
            virtualController = GameObject.FindWithTag("JoyStick").GetComponent <CNJoystick>();
        }
#endif
    }
Пример #4
0
    // Use this for initialization
    void Awake()
    {
        charController = GetComponent<CharacterController>();
        cameraRelativeSetup = GetComponent<CNCameraRelativeSetup>();
        joystick = cameraRelativeSetup.joystick;

        joystick.JoystickMovedEvent += AnimateMovement;
        joystick.FingerLiftedEvent += StoppedMoving;
    }
    // Use this for initialization
    void Start()
    {
                #if MOBILE_INPUT
        MovementJoystick = GameObject.FindWithTag("joystick").GetComponent <CNJoystick>();
        MovementJoystick.ControllerMovedEvent += mobileSendMovement;
        MovementJoystick.FingerLiftedEvent    += mobileLiftedFinger;
        GameObject.FindWithTag("joystick").GetComponentInParent <Camera>().enabled = true;

        //make camera size bigger
        Camera.main.orthographicSize = 3.5f;
                #endif

        GameObject.FindGameObjectWithTag("gameEndText").GetComponent <UnityEngine.UI.Text>().enabled = false;
        audioPlayer   = transform.GetChild(0).GetComponent <AudioSource>();
        ballAnimation = transform.GetChild(0).GetComponent <Animator>();
    }
Пример #6
0
    public void ScaleBackInGameUI()
    {
        leaderboard.transform.localScale    = leaderboardScale;
        currentRank.transform.localScale    = currentRankScale;
        currentScore.transform.localScale   = currentScoreScale;
        currentTeam.transform.localScale    = currentTeamScale;
        jumpButton.transform.localScale     = jumpButtonScale;
        fireButton.transform.localScale     = fireButtonScale;
        drinkButton.transform.localScale    = drinkButtonScale;
        changeIdButton.transform.localScale = changeIdButtonScale;
        joystick.transform.localScale       = joystickScale;
        CNJoystick joystickScript = joystick.transform.FindChild("CNJoystick").gameObject.GetComponent <CNJoystick> ();

        joystickScript.enabled = true;

        UIvisible = true;
    }
Пример #7
0
    public void ScaleDownInGameUI()
    {
        leaderboard.transform.localScale    = Vector3.zero;
        currentRank.transform.localScale    = Vector3.zero;
        currentScore.transform.localScale   = Vector3.zero;
        currentTeam.transform.localScale    = Vector3.zero;
        jumpButton.transform.localScale     = Vector3.zero;
        fireButton.transform.localScale     = Vector3.zero;
        drinkButton.transform.localScale    = Vector3.zero;
        changeIdButton.transform.localScale = Vector3.zero;
        joystick.transform.localScale       = Vector3.zero;
        CNJoystick joystickScript = joystick.transform.FindChild("CNJoystick").gameObject.GetComponent <CNJoystick> ();

        joystickScript.enabled = false;

        UIvisible = false;
    }
Пример #8
0
    void Start()
    {
        //Implements Singleton
        if (_instance != null)
        {
            Debug.LogError("Can't initialize more than one instance of Game Manager!");
            return;
        }
        _currentPlayerShips        = new List <Player>();
        _instance                  = this;
        _needToInitSeebrightCamera = gameObject.GetComponent <SeebrightSDK>().enabled = enableSeebright;
#if UNITY_IPHONE
        if (!enableSeebright && !isMenu)
        {
            if (joystickLeft != null)
            {
                joystickLeft.SetActive(true);
                _joystickLeftAPI = joystickLeft.GetComponentInChildren <CNJoystick>();
                _joystickLeftAPI.JoystickMovedEvent += _joystickAPI_JoystickMovedEvent;
                _joystickLeftAPI.FingerLiftedEvent  += _joystickAPI_FingerLiftedEvent;
                joystickLeft.SetActive(invertedControls);
            }
            if (joystickRight != null)
            {
                joystickRight.SetActive(true);
                _joystickRightAPI = joystickRight.GetComponentInChildren <CNJoystick>();
                _joystickRightAPI.JoystickMovedEvent += _joystickAPI_JoystickMovedEvent;
                _joystickRightAPI.FingerLiftedEvent  += _joystickAPI_FingerLiftedEvent;
                joystickRight.SetActive(!invertedControls);
            }
            _triggerButton = GetComponent <TriggerButton>();
            if (_triggerButton != null)
            {
                _triggerButton.enabled = true;
            }
            else
            {
                Debug.LogError("No trigger button for iOS build!");
            }
        }
#endif
    }
    void Start()
    {
        Physics.gravity = new Vector3(0, -jumpFactor, 0);
        joystick = GameObject.Find ("CNJoystick").GetComponent<CNJoystick> ();

        timeController = GameObject.Find("TimeController").GetComponent<TimeController>();

        //subscribe to the recorder for recording movement
        recorder = GameObject.Find ("TimeController").GetComponent<Recorder> ();
        recorder.Subscribe (this);
    }
Пример #10
0
 // Use this for initialization
 void Start()
 {
     CNLeft  = LeftJoy.GetComponent <CNJoystick> ();
     CNRight = RightJoy.GetComponent <CNJoystick> ();
 }