// 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()); } } }
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"); } } }
public void Instantiate(PlayerInfos infos, float z_offset) { controls = infos.GetControls(); if (infos.GetBoatId() == GameTime.BLUE_BOAT_ID) { boat = GameTime.GetBlueBoat(); } else { boat = GameTime.GetRedBoat(); } this.gameObject.transform.position = boat.gameObject.transform.position + new Vector3(0, 5, z_offset); infos.GetModelInfos().SetModelToModelParameters(this.gameObject); }
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()); }
public void InstantiateCeleb(PlayerInfos infos, bool front, float x_offset) { GetMAnimator(); controls = infos.GetControls(); if (front) { boat = WinnerTime.GetFront(); this.HasWon(x_offset >= 0 ? 1 : 0); } else { boat = WinnerTime.GetBack(); this.HasLost(x_offset >= 0 ? 1 : 0); } this.gameObject.transform.position = boat.gameObject.transform.position + new Vector3(x_offset, 0, 0); infos.GetModelInfos().SetModelToModelParameters(this.gameObject); SetIsInteracting(true); transform.localScale = new Vector3(3, 3, 3); gameObject.GetComponent <Rigidbody>().isKinematic = true; }