// Update is called once per frame void Update() { timer.Update(); if (timer.Time < 0.2f) { return; } if (controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.UP).GetDown()) { current--; if (current < 0) { current = buttons.Count - 1; } buttons[current].Select(); timer.Reset(); } else if (controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.DOWN).GetDown()) { current++; if (current >= buttons.Count) { current = 0; } buttons[current].Select(); timer.Reset(); } if (controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.ATTACK).Get()) { buttons[current].OnSubmit(null); } }
// Update is called once per frame void Update() { if (!active) { pressToJoin.SetActive(true); playerReady.SetActive(false); selectYourColor.SetActive(false); } else if (ready) { pressToJoin.SetActive(false); playerReady.SetActive(true); selectYourColor.SetActive(false); } else if (!ready) { pressToJoin.SetActive(false); playerReady.SetActive(false); selectYourColor.SetActive(true); } if (!active) { return; } if (!stop && !ready) { if (controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.LEFT).GetDown()) { current = (current - 1) % materials.Count; } if (controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.RIGHT).GetDown()) { current = (current + 1) % materials.Count; } if (current < 0) { current = materials.Count - 1; } Debug.Log(current); renderer.material = materials [current]; stop = true; } if (stop && !(controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.LEFT).Get() || controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.RIGHT).Get())) { stop = false; } if (controller.GetInput(LZFight.LZFIGHTERINPUTEVENT.ATTACK).GetDown()) { ready = true; } }
// Update is called once per frame void Update() { GameConfiguration gconf = GameConfiguration.instance; if (p1.Ready && p2.Ready) // || gconf.p2isAI)) { { if (gconf.p2isAI) { gconf.p2material = p2.materials[Random.Range(0, p2.materials.Count)]; } SceneManager.LoadScene("level1"); return; } p2.active = !gconf.p2isAI; if (c2.GetInput(LZFight.LZFIGHTERINPUTEVENT.ATTACK).GetDown()) { gconf.p2isAI = false; } if (c1.GetInput(LZFight.LZFIGHTERINPUTEVENT.DASH).GetDown()) { if (p1.Ready) { p1.Ready = false; } else { SceneManager.LoadScene("Title"); } } if (c2.GetInput(LZFight.LZFIGHTERINPUTEVENT.DASH).GetDown()) { if (p2.Ready) { p2.Ready = false; } else if (!gconf.p2isAI) { gconf.p2isAI = true; } else { SceneManager.LoadScene("Title"); } } gconf.p1material = p1.GetCurrentMaterial(); gconf.p2material = p2.GetCurrentMaterial(); }
public bool ValidateInput(LZFighterStateTransition.Input input) { LZFIGHTERINPUTEVENT inputEvent = input.ev; if (invertHorizontal) { if (inputEvent == LZFIGHTERINPUTEVENT.RIGHT) { inputEvent = LZFIGHTERINPUTEVENT.LEFT; } else if (inputEvent == LZFIGHTERINPUTEVENT.LEFT) { inputEvent = LZFIGHTERINPUTEVENT.RIGHT; } } InputObject inputObject = controller.GetInput(inputEvent); bool value = false; switch (input.type) { case LZFighterStateTransition.INPUT_TYPE.DOWN: value = inputObject.GetDown(); break; case LZFighterStateTransition.INPUT_TYPE.UP: value = inputObject.GetUp(); break; case LZFighterStateTransition.INPUT_TYPE.VALUE: value = inputObject.Get(); break; default: break; } return(value); }