public void SetState(int x, int y, MaskState state) { GridPosition _p = grid.Grid [x, y]; if (state == MaskState.UNUSED) { _p.DoorID = -1; _p.IsPartOfPath = false; _p.ShouldBeEmpty = false; } else if (state == MaskState.FILL) { _p.DoorID = -1; _p.IsPartOfPath = true; _p.ShouldBeEmpty = false; } else if (state == MaskState.EMPTY) { _p.DoorID = -1; _p.IsPartOfPath = false; _p.ShouldBeEmpty = true; } else if (state == MaskState.DOOR) { _p.DoorID = 1; _p.IsPartOfPath = false; _p.ShouldBeEmpty = false; } }
private Color StateColor(int i, int j) { int[] center = hallway.CenterIndices; MaskState state = hallway.GetState(i, j); if (i == center [0] && j == center [1]) { return(Color.green); } else { switch (state) { case MaskState.UNUSED: return(Color.white); case MaskState.FILL: return(Color.cyan); case MaskState.EMPTY: return(Color.red); case MaskState.DOOR: return(Color.blue); } } return(Color.white); }
private void ClearState() { _state = _target; _current = 0f; _flag = false; mGroup.alpha = _to; fadeInComplete = null; fadeOutComplete = null; }
private Color ColorForState(MaskState state) { switch (state) { case MaskState.DOOR: return(new Color(0f, 0f, 1f, 0.5f));; case MaskState.EMPTY: return(new Color(1f, 0f, 0f, 0.5f));; default: return(Color.white); } }
public void FadeOut(Action complete = null) { if (_state == MaskState.closed && !_flag) { _flag = true; _from = 0; _to = 1; mGroup.alpha = _from; _target = MaskState.open; fadeOutComplete = complete; } }
void wrongGuess(GameObject maskObj) { Debug.Log("Wrong"); countWrongGuess++; MaskState maskState = maskObj.GetComponent <MaskState> (); if (maskState != null) { maskState.MaskCanSeen = true; thisPlayerInfo.CmdShowMask(maskState.gameObject); } }
public void SwitchState(int x, int y, MaskState state) { switch (GetState(x, y)) { case MaskState.UNUSED: SetState(x, y, MaskState.FILL); break; case MaskState.FILL: SetState(x, y, MaskState.EMPTY); break; case MaskState.EMPTY: SetState(x, y, MaskState.UNUSED); break; } }
void correctGuess(GameObject maskObj) { Debug.Log("Correct"); QuestionPieceState qs = questionPiece.GetComponent <QuestionPieceState> (); qs.totalCorrectGuess = qs.totalCorrectGuess + 1; countCorrectGuess = qs.totalCorrectGuess; thisPlayerInfo.CmdTotalCorrectChange(qs.gameObject, countCorrectGuess); thisPlayerInfo.myCorrectGuess++; thisPlayerInfo.CmdChangeMyCorrectGuess(thisPlayerInfo.myCorrectGuess); MaskState maskState = maskObj.GetComponent <MaskState> (); if (maskState != null) { maskState.successGuess = true; thisPlayerInfo.CmdCloseButton(maskState.gameObject); } }
public void Render() { Framebuffer.Execute(); Viewport.Execute(); BlendState.Execute(); FaceCullState.Execute(); MaskState.Execute(); DepthState.Execute(); StencilState.Execute(); Clear.Execute(); camera.UpdateFrame(); camera.UpdateViewport(Viewport.Viewport); foreach (var item in renderItems) { #if false if (item.Model.Frame != frame) { camera.UpdateModelFrame(frame); } #endif //item.Batch.Mesh.ApplyAttributes( } }
public void clickMask(GameObject maskObj) { if (gameStart == false && gameFinish == false) { gameStart = true; } if (!startGuess) { startGuess = true; countGuess++; MaskState maskState = maskObj.GetComponent <MaskState> (); if (maskState != null) { maskState.MaskCanSeen = false; thisPlayerInfo.CmdCloseMask(maskState.gameObject); } guessPuzzleIndex = maskState.maskID; StartCoroutine(CheckIfPuzzleMatch(maskObj)); } }
private bool IsMatchingSegment(MaskState state, GridPosition pos) { return(state == MaskState.FILL && pos.IsPartOfPath || state == MaskState.EMPTY && !pos.IsPartOfPath); }
void Update() { //Debug.Log(Timer); if (moveenable) { //緩速控制 switch (_FreezeState) { case MaskState.None: { Timer = 0f; transform.Translate(Vector3.down * Time.deltaTime * movespeed); if (enable) { _IsPlayed = true; _FreezeState = MaskState.Enable; } } break; case MaskState.Enable: { Timer += Time.deltaTime; if(_IsPlayed) { _fx.PlayPosionAnimation(); _IsPlayed = false; } transform.Translate(Vector3.down * Time.deltaTime * (movespeed / 2)); if (Timer >= ActiveTimer) { enable = false; _FreezeState = MaskState.None; } } break; } } #if UNITY_ANDROID /*舊流程 //三種情況,左按、右按和不按 if (Left) { LerpNum = Mathf.Lerp(LerpNum, 1, Time.deltaTime); } else if (Right) { LerpNum = Mathf.Lerp(LerpNum, -1, Time.deltaTime); } else { LerpNum = 0f; } */ //依Lerp值做旋轉(LerpNum值由介面按鈕做控制) transform.Rotate(new Vector3(0f, 0f, LerpNum * 4f)); #endif #if DEBUG Debug.Log(Input.GetAxis("Player1")); #endif }
private bool IsMatchingSegment(MaskState state, GridPosition pos) { return((state == MaskState.DOOR && pos.IsDoor) || (state == MaskState.FILL && pos.IsPartOfPath) || (state == MaskState.EMPTY && !pos.IsPartOfPath)); }
/**In case I need to create a specific type of mask (not random)**/ public void InitializeSpecificMask(MaskState _ms, MaskType _mt) { MyMaskState = _ms; MyMaskType = _mt; }
public void CloseMask() { _state = MaskState.closed; mGroup.alpha = 1; }
public void OpenMask() { _state = MaskState.open; mGroup.alpha = 0; }
void Update() { switch (myMaskState) { case MaskState.None: MaskTimer = 0f; CooldownTimer = 0f; maskSprite.gameObject.SetActive(false); ((Sct_GameUI)(Sct_UIMgr.instance.UIControl)).setBounsBtn((int)variable.LavaType,true,state.CurrentState); if (enable) { myMaskState = MaskState.Enable; sound.PlaySound(Sct_SoundManager.Instance.EnableMaskSound); ((Sct_GameUI)(Sct_UIMgr.instance.UIControl)).setBounsBtn((int)variable.LavaType, false, state.CurrentState); } break; case MaskState.Enable: MaskTimer += Time.deltaTime; CooldownTimer = 0f; maskSprite.gameObject.SetActive(true); if (MaskTimer >= _activeT) myMaskState = MaskState.CoolDown; break; case MaskState.CoolDown: MaskTimer = 0f; CooldownTimer += Time.deltaTime; maskSprite.gameObject.SetActive(false); if (CooldownTimer >= _cooldownT) { enable = false; myMaskState = MaskState.None; } break; } }
private bool NeedsToDrawCube(MaskState state) { return(state == MaskState.EMPTY || state == MaskState.DOOR); }
void Update() { GameObject[] playerLists = GameObject.FindGameObjectsWithTag("networkPlayer"); int numberOfPlayers = playerLists.Length; // Client drop connection if (numberOfPlayers == 1) { if (DisconnectPlayer.activeSelf == false) { DisconnectPlayer.SetActive(true); DisconnectPlayerBody.color = pc [1]; int guess = countCorrectGuess - playerLists [0].GetComponent <GamePlayerController> ().myCorrectGuess; DisconnectPlayerGuess.text = guess.ToString(); } } else { DisconnectPlayer.SetActive(false); } // Auto Guess if (gameStart == true && gameFinish == false) { if (numberOfPlayers == 1 && questionPieceState.currentPlayerID == 2) { int randomTime = 12; if (TurnBasedController.time <= randomTime) { QuestionPieceState qs = questionPiece.GetComponent <QuestionPieceState> (); qs.totalCorrectGuess = qs.totalCorrectGuess + 1; countCorrectGuess = qs.totalCorrectGuess; thisPlayerInfo.CmdTotalCorrectChange(qs.gameObject, countCorrectGuess); string name = "GuessMask (" + qs.PieceID + ")"; GameObject maskObj = GameObject.Find(name); MaskState maskState = maskObj.GetComponent <MaskState> (); if (maskState != null) { maskState.MaskCanSeen = false; thisPlayerInfo.CmdCloseMask(maskState.gameObject); maskState.successGuess = true; thisPlayerInfo.CmdCloseButton(maskState.gameObject); int guess = countCorrectGuess - playerLists [0].GetComponent <GamePlayerController> ().myCorrectGuess; DisconnectPlayerGuess.text = guess.ToString(); } CheckIfGameIsFinished(); if (gameStart == false && gameFinish == true) { completeLabel.SetActive(true); lines.SetActive(false); resultPanel.SetActive(true); } startGuess = false; TurnBasedController.time = 0.0f; } } } }
public MaskSegment(int[] offset, MaskState state, int rotation) { this.Offset = offset; this.State = state; this.RotatedBy = rotation; }
/**In case I need to create a specific type of mask (not random)**/ public void InitializeSpecificMask(MaskState _ms, MaskType _mt) { MyMaskState = _ms; MyMaskType = _mt; }