// Use this for initialization void Start() { Control control = GameObject.FindGameObjectWithTag("Control").GetComponent <Control>(); count = WiiMoteControl.wiimote_count(); bi = GameObject.FindGameObjectWithTag("BattleInformer").GetComponent <BattleInformer>(); }
// Update is called once per frame void Update() { time += Time.deltaTime; if (time > firsTime) { if (firsTime > 0) { control = GameObject.FindGameObjectWithTag("Control").GetComponent <Control>(); firsTime = -1; } switch (state) { case IntroState.Detecting: if (WiiMoteControl.wiimote_count() > 1) { SetState(IntroState.Studio); } break; case IntroState.Studio: if (time > studioTime) { SetState(IntroState.Credits); } break; case IntroState.Credits: if (time > creditsTime) { SetState(IntroState.Video); } break; case IntroState.Video: if (control.Accept()) { Application.LoadLevel(Application.loadedLevel + 1); } if (!((MovieTexture)renderer.material.mainTexture).isPlaying && !audio.isPlaying) { Application.LoadLevel(Application.loadedLevel + 1); } break; } } }
// Use this for initialization void Start() { Physics.gravity = new Vector3(0, -9.81f, 0); Time.timeScale = 1.0f; Control control = GameObject.FindGameObjectWithTag("Control").GetComponent <Control>(); BattleInformer bi = GameObject.FindGameObjectWithTag("BattleInformer").GetComponent <BattleInformer>(); int c = WiiMoteControl.wiimote_count(); if (c > 0) { for (int i = 0; i <= c - 1; i++) { //control.RegisterPlayer(Control.ControllerType.WiiMote, i); bi.changePlayer(standardAvatar, i, 0); } } else { Debug.Log("No hay mandos, tolai!"); } }
// Update is called once per frame void Update() { if (automaticDetect) { int c = WiiMoteControl.wiimote_count(); //Debug.Log("AutomaticDetecting_ "+c); if (c > players) { for (int i = players; i <= Mathf.Min(c - 1, 4); i++) { RegisterPlayer(ControllerType.WiiMote, i); } } automaticDetect = false; } //Debug.Log(WiiMoteControl.wiimote_getButton2(playerControllerId[0])); for (int i = 0; i < 4; ++i) { if (types[i] == ControllerType.Undefined) { continue; } switch (types[i]) { case ControllerType.WiiMote: int id = playerControllerId[i]; for (int j = 0; j < 7; ++j) { bool button = false; switch (j) { case 0: button = JumpButton(i); break; case 1: button = AttackButton(i); break; case 2: button = AbilityWorldButton(i); break; case 3: button = AbilityGravityButton(i); break; case 4: button = AbilityPowerUpButton(i); break; case 5: button = AbilitySkillButton(i); break; case 6: button = PauseButton(i); break; } if (button && !lastPressed[j, i]) { pressedTime[j, i] = Time.time; } lastPressed[j, i] = button; } //AXIS //Case not nunchuck if (!WiiMoteControl.wiimote_isExpansionPortEnabled(id)) { if (WiiMoteControl.wiimote_getButtonRight(id)) // UP { if (playerAxis[i].v < 0.0f) { playerAxis[i].v = 0.0f; } playerAxis[i].v = Mathf.Lerp(playerAxis[i].v, 1.0f, AXIS_SPEED * Time.deltaTime); } else if (WiiMoteControl.wiimote_getButtonLeft(id)) // DOWN { if (playerAxis[i].v > 0.0f) { playerAxis[i].v = 0.0f; } playerAxis[i].v = Mathf.Lerp(playerAxis[i].v, -1.0f, AXIS_SPEED * Time.deltaTime); } else { playerAxis[i].v = Mathf.Lerp(playerAxis[i].v, 0f, AXIS_SPEED * 2f * Time.deltaTime); } if (WiiMoteControl.wiimote_getButtonDown(id)) // RIGHT { if (playerAxis[i].h < 0.0f) { playerAxis[i].h = 0.0f; } playerAxis[i].h = Mathf.Lerp(playerAxis[i].h, 1.0f, AXIS_SPEED * Time.deltaTime); } else if (WiiMoteControl.wiimote_getButtonUp(id)) // LEFT { if (playerAxis[i].h > 0.0f) { playerAxis[i].h = 0.0f; } playerAxis[i].h = Mathf.Lerp(playerAxis[i].h, -1.0f, AXIS_SPEED * Time.deltaTime); } else { playerAxis[i].h = Mathf.Lerp(playerAxis[i].h, 0, AXIS_SPEED * 2f * Time.deltaTime); } } break; default: break; } actualSlope[i] = SlopeButton(i); } }