Esempio n. 1
0
    void Awake()
    {
        instance = this;
        instance.errorText.text = "";
        availableControls       = new List <PlayerControls>();
        availableControls.Add(new PlayerControls('K', "Horizontal", "Vertical", "Interact", "Action", PlayerControls.NAME_LEFT_CLAVIER));
        availableControls.Add(new PlayerControls('K', "Horizontal1", "Vertical1", "Interact1", "Action1", PlayerControls.NAME_RIGHT_CLAVIER));
        availableControls.Add(new PlayerControls('V', "VoidAxis", "VoidAxis", "VoidKey", "VoidKey", PlayerControls.VIDE));


        //availableControls.Add(new PlayerControls('C',"Horizontal1", "Vertical1", "Interact1", "Action1", PlayerControls.NAME_MANETTE_1));//DELETE
        //availableControls.Add(new PlayerControls('C',"Horizontal4", "Vertical4", "Interact4", "Action4", PlayerControls.NAME_MANETTE_2));


        controllerSize = Input.GetJoystickNames().Length;
        if (controllerSize > 0 && Input.GetJoystickNames()[0] == "")
        {
            controllerSize -= 1;
        }
        //Debug.Log("Controller size= " + controllerSize);
        if (controllerSize == 1)
        {
            //Debug.Log(Input.GetJoystickNames()[0]);
            availableControls.Add(new PlayerControls('C', "Horizontal3", "Vertical3", "Interact3", "Action3", PlayerControls.NAME_MANETTE_1));
        }
        if (controllerSize == 2)
        {
            availableControls.Add(new PlayerControls('C', "Horizontal4", "Vertical4", "Interact4", "Action4", PlayerControls.NAME_MANETTE_2));
        }
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        /* length = characterPrefabs.Length;
         * characterShow = new GameObject[length];
         *
         * for (int i = 0; i < length; i++)
         * {
         *  characterShow[i] = (GameObject)Instantiate(characterPrefabs[i], transform.position, transform.rotation);
         * }
         *
         * UpdateCharacterShow(); */
        baseCamera = mainCamera.transform.position;
        if (slot_id != CharaMenuHandler.DEFAULT_SLOT)
        {
            infos = new PlayerInfos(CharaMenuHandler.GetNextAvailableControl(null), slot_id);

            if (slot_id == 0)
            {
                playerObject = Instantiate(GameTime.GetRedModel(), transform.position, transform.rotation);
                playerObject.GetComponent <Player>().InstantiateMenu(infos);
                infos.GetModelInfos().SetModelToModelParameters(playerObject);
            }
            else if (slot_id == 1)
            {
                playerObject = Instantiate(GameTime.GetBlueModel(), transform.position, transform.rotation);
                playerObject.GetComponent <Player>().InstantiateMenu(infos);
                infos.GetModelInfos().SetModelToModelParameters(playerObject);
            }
            CharaMenuHandler.AddCharaSelect(this);
            if (display != null)
            {
                display.Display(infos.GetControls());
            }
        }
    }
Esempio n. 3
0
 public void UnPersonalize()
 {
     mainCamera.transform.position = baseCamera;
     playerCanvas.gameObject.SetActive(false);
     boatCanvas.gameObject.SetActive(true);
     CharaMenuHandler.SetCurrentPersonnalizationSlot(CharaMenuHandler.DEFAULT_SLOT);
 }
Esempio n. 4
0
 public void Personalize()
 {
     if (slot_id != CharaMenuHandler.DEFAULT_SLOT)
     {
         mainCamera.transform.position = transform.position + new Vector3(0, 14, -15);
         playerCanvas.gameObject.SetActive(true);
         boatCanvas.gameObject.SetActive(false);
         CharaMenuHandler.SetCurrentPersonnalizationSlot(slot_id);
     }
 }
Esempio n. 5
0
 public void SetSlot(int slot_id)
 {
     infos        = new PlayerInfos(CharaMenuHandler.GetNextAvailableControl(null), slot_id);
     this.slot_id = slot_id;
     if (slot_id == 2)
     {
         playerObject = Instantiate(GameTime.GetRedModel(), transform.position, transform.rotation);
         playerObject.GetComponent <Player>().InstantiateMenu(infos);
         infos.GetModelInfos().SetModelToModelParameters(playerObject);
     }
     else if (slot_id == 3)
     {
         playerObject = Instantiate(GameTime.GetBlueModel(), transform.position, transform.rotation);
         playerObject.GetComponent <Player>().InstantiateMenu(infos);
         infos.GetModelInfos().SetModelToModelParameters(playerObject);
     }
     CharaMenuHandler.AddCharaSelect(this);
     display.Display(infos.GetControls());
 }
Esempio n. 6
0
    public void PreviousControl()
    {
        if (slot_id != CharaMenuHandler.DEFAULT_SLOT)
        {
            PlayerControls tmpControls = CharaMenuHandler.GetNextAvailableControl(infos.GetControls());
            if (tmpControls != null)
            {
                infos.ChangeControls(tmpControls);

                //UPDATE AFFICHAGE CONTROLS
                display.Display(infos.GetControls());
            }
            else
            {
                //ERROR

                //CharaMenuHandler.SetErrorMessage("Plus de controles disponibles, ajoutez une manette");
            }
        }
    }