예제 #1
0
    void Start()
    {
        controlls = GameObject.FindGameObjectWithTag("GameController").GetComponent <Controlls>();

        characterDirection = Direction.Right;

        UpdateShieldDirection();
    }
예제 #2
0
 // Use this for initialization
 private void Awake()
 {
     LevelManager        = GameObject.Find("/LevelManager").GetComponent <LevelManager>();
     _acceleration       = MaxSpeed;
     _currentSpeed       = 0;
     _remainingNitroTime = NitroTime;
     Size       = 20.0f;
     _controlls = new Controlls(name);
 }
예제 #3
0
 private void OnEnable()
 {
     //sets up the car controller
     if (controls == null)
     {
         controls = new Controlls();
         //sets up the drifting controlls
     }
     controls.MainMenu.Enable();
 }
예제 #4
0
파일: Player.cs 프로젝트: vMacho/MekaBoy
    void Start()
    {
        velocity = new Vector3 ();

        controllerSettings = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameData>().controllerSettings;
        if(controllerSettings == null) Debug.Log ("ERROR NO SE ENCONTRO LA CONFIGURACION POR DEFECTO");

        pauseGame = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameData> ().paused;

        Pad = GameObject.Find ("PadController").GetComponent<PadController> ();
    }
예제 #5
0
 private void OnEnable()
 {
     //sets up the car controller
     if (controls == null)
     {
         controls = new Controlls();
         //sets up the drifting controlls
         controls.CarController.Drift.canceled += ctx => { StopDrifting(); };
         controls.CarController.Drift.started  += ctx => { StartDrifting(); };
     }
     controls.CarController.Enable();
 }
    private void Awake()
    {
        background.gameObject.SetActive(false);
        rectTransform = gameObject.GetComponent <RectTransform>();
        Controlls.SetSize(rectTransform, new Vector2(Screen.width / 2, Screen.height));

        if (gameObject.CompareTag("Left_Joystick"))
        {
            Controlls.SetPositionOfPivot(rectTransform, new Vector2(-Screen.width / 2, -Screen.height / 2));
        }
        else if (gameObject.CompareTag("Right_Joystick"))
        {
            Controlls.SetPositionOfPivot(rectTransform, new Vector2(Screen.width / 2, -Screen.height / 2));
        }
    }
예제 #7
0
파일: GameData.cs 프로젝트: vMacho/MekaBoy
    void Start()
    {
        controllerSettings = new Controlls ();

        if (playerOne == null) Debug.Log ("Necesario agregar el prefab player");
        else
        {
            playerOne.transform.position = playerPositionInicial;
        }

        if (cameraGame == null) Debug.Log ("Necesario agregar el prefab cameraGame");
        else cameraGame.GetComponent<CameraControl> ().setTarget (playerOne);

        if (sun == null) Debug.Log ("Necesario agregar el sol");
        else sun.transform.rotation = Quaternion.Euler (sunRotation);
    }
예제 #8
0
 private void Start()
 {
     controlls = GameObject.FindGameObjectWithTag("GameController").GetComponent <Controlls>();
     range     = controlls.GetRange();
 }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     offset          = -10;
     playerObject    = GameObject.FindGameObjectWithTag("Player");
     playerControlls = playerObject.GetComponent <Controlls>();
 }
예제 #10
0
    /// <summary>
    /// Method to create default Controlls.
    /// </summary>
    /// <returns>A dictionary with the default controlls mapped to the default keys.</returns>
    public Dictionary <Controlls, KeyCode[]> createControlls()
    {
        Dictionary <Controlls, KeyCode[]> controlls = new Dictionary <Controlls, KeyCode[]>();

        foreach (Controlls ctrl in Controlls.GetValues(typeof(Controlls)))
        {
            KeyCode[] keys = new KeyCode[2];
            if (ctrl == Controlls.Ability_Hotkey_0)
            {
                keys[0] = KeyCode.Alpha1;
                keys[1] = KeyCode.Keypad1;
            }
            else if (ctrl == Controlls.Ability_Hotkey_1)
            {
                keys[0] = KeyCode.Alpha2;
                keys[1] = KeyCode.Keypad2;
            }
            else if (ctrl == Controlls.Ability_Hotkey_2)
            {
                keys[0] = KeyCode.Alpha3;
                keys[1] = KeyCode.Keypad3;
            }
            else if (ctrl == Controlls.Ability_Hotkey_3)
            {
                keys[0] = KeyCode.Alpha4;
                keys[1] = KeyCode.Keypad4;
            }
            else if (ctrl == Controlls.Ability_Hotkey_4)
            {
                keys[0] = KeyCode.Alpha5;
                keys[1] = KeyCode.Keypad5;
            }
            else if (ctrl == Controlls.Ability_Hotkey_5)
            {
                keys[0] = KeyCode.Alpha6;
                keys[1] = KeyCode.Keypad6;
            }
            else if (ctrl == Controlls.Ability_Hotkey_6)
            {
                keys[0] = KeyCode.Alpha7;
                keys[1] = KeyCode.Keypad7;
            }
            else if (ctrl == Controlls.Ability_Hotkey_7)
            {
                keys[0] = KeyCode.Alpha8;
                keys[1] = KeyCode.Keypad8;
            }
            else if (ctrl == Controlls.Ability_Hotkey_8)
            {
                keys[0] = KeyCode.Alpha9;
                keys[1] = KeyCode.Keypad9;
            }
            else if (ctrl == Controlls.Ability_Hotkey_9)
            {
                keys[0] = KeyCode.Alpha0;
                keys[1] = KeyCode.Keypad0;
            }
            else if (ctrl == Controlls.Camera_Scroll_Up)
            {
                keys[0] = KeyCode.W;
                keys[1] = KeyCode.UpArrow;
            }
            else if (ctrl == Controlls.Camera_Scroll_Down)
            {
                keys[0] = KeyCode.S;
                keys[1] = KeyCode.DownArrow;
            }
            else if (ctrl == Controlls.Camera_Scroll_Left)
            {
                keys[0] = KeyCode.A;
                keys[1] = KeyCode.LeftArrow;
            }
            else if (ctrl == Controlls.Camera_Scroll_Right)
            {
                keys[0] = KeyCode.D;
                keys[1] = KeyCode.RightArrow;
            }
            else if (ctrl == Controlls.Camera_Turn_Left)
            {
                keys[0] = KeyCode.Q;
                keys[1] = KeyCode.LeftBracket;
            }
            else if (ctrl == Controlls.Camera_Turn_Right)
            {
                keys[0] = KeyCode.E;
                keys[1] = KeyCode.RightBracket;
            }
            else if (ctrl == Controlls.Next_Player)
            {
                keys[0] = KeyCode.Equals;
                keys[1] = KeyCode.KeypadPlus;
            }
            else if (ctrl == Controlls.Previous_Player)
            {
                keys[0] = KeyCode.Minus;
                keys[1] = KeyCode.KeypadMinus;
            }
            else if (ctrl == Controlls.Pause)
            {
                keys[0] = KeyCode.P;
                keys[1] = KeyCode.P;
            }
            controlls.Add(ctrl, keys);
        }

        return(controlls);
    }
예제 #11
0
 // Use this for initialization
 void Start()
 {
     _rigidBody = GetComponent <Rigidbody2D>();
     _controlls = GetComponent <Controlls>();
 }