// Update is called once per frame void Update() { if (GamePlayManager.CurGameState != GamePlayManager.GameState.InGame) { return; } //catch input information if (Input.GetKeyDown(fireKey)) { isOn = !isOn; playerMeshRenderer.material.color = (isOn)? GeneralTable.GetColor(type) : GeneralTable.GetColor(GeneralTable.Type.White); if (isOn) { EnType(); } else { DeType(); } } if (Input.GetKeyDown(changeDirKey) && isOn) { ChangeWaypointColor(); } }
private void OnTriggerEnter(Collider other) { ColorBall tempColorBall = other.gameObject.GetComponent <ColorBall>(); if (tempColorBall) { // Don't case equal for now lol if ((int)type > (int)tempColorBall.type) { type = GeneralTable.Combine(type, tempColorBall.type); BallColor = GeneralTable.GetColor(type); GamePlayManager.Instance.centerPoint.RemoveEstimateColorBallNum(); } else { Destroy(this.gameObject); } } CenterPoint tempCenterPoint = other.gameObject.GetComponent <CenterPoint>(); if (tempCenterPoint) { nextCenterPoint.match(type); ballCollider.enabled = false; } }
// if Color match queue color, add one point, and create another color into queue. public bool match(GeneralTable.Type typeValue) { currentColorBallNum++; bool result = false; if (!typeValue.Equals(targetTypeQueue.Peek())) { failFlag = true; result = true; } if (currentColorBallNum == estimateColorBallNum) { GamePlayManager.Instance.ResetTimer(); if (failFlag) { PerformFail(); } else { currentPoint++; GamePlayManager.Instance.NextStage(); GeneralTable.Type currentType = targetTypeQueue.Peek(); while (currentType == targetTypeQueue.Peek()) { targetTypeQueue.Dequeue(); targetTypeQueue.Enqueue(GeneralTable.GetRandomType()); } centerPointMeshRenderer.material.color = GeneralTable.GetColor(targetTypeQueue.Peek()); } } return(result); }
public void DeType(GeneralTable.Type type) { myType = GeneralTable.Remove(myType, type); waypointMeshRenderer.material.color = GeneralTable.GetColor(myType); if (colorLine) { colorLine.RemoveType(type); } if (colorLines.Length > 0) { colorLines[nextWaypointIndex].RemoveType(type); } }
void OnGameOver() { if (startWaypoint.nextWaypointIndex != 0) { ChangeWaypointColor(); } if (!isOn) { EnType(); } isOn = true; playerMeshRenderer.material.color = GeneralTable.GetColor(type); }
public void FireColorBall() { if (ps) { ps.Clear(); //ps.startColor = GeneralTable.GetColor(type); ps.Play(); } GameObject colorballGO = Instantiate(colorBallRef); colorballGO.transform.position = new Vector3(this.transform.position.x, 1, this.transform.position.z); colorballGO.GetComponent <ColorBall>().type = type; colorballGO.GetComponent <ColorBall>().BallColor = GeneralTable.GetColor(type); colorballGO.GetComponent <ColorBall>().nextWaypoint = startWaypoint; }
public void Reset() { currentPoint = 0; blackFlag = false; cumulativeTime = 0; estimateColorBallNum = 0; currentColorBallNum = 0; failFlag = false; targetTypeQueue.Clear(); for (int i = 0; i < countMax; ++i) { targetTypeQueue.Enqueue(GeneralTable.GetRandomType()); } centerPointMeshRenderer.material.color = GeneralTable.GetColor(targetTypeQueue.Peek()); this.transform.localScale = new Vector3(fixedScale, fixedScale, fixedScale); }
public void Start() { colorLineRenderer.material.color = GeneralTable.GetColor(colorType); }
public void RemoveType(GeneralTable.Type type) { colorType = GeneralTable.Remove(type, colorType); colorLineRenderer.material.color = GeneralTable.GetColor(colorType); }
public void AddType(GeneralTable.Type type) { colorType = GeneralTable.Combine(type, colorType); colorLineRenderer.material.color = GeneralTable.GetColor(colorType); }
void init() { GamePlayManager.OnGameOver += OnGameOver; //keep and do something playerMeshRenderer.material.color = GeneralTable.GetColor(type); }
private void Update() { if (blackFlag) { cumulativeTime += Time.deltaTime; centerPointMeshRenderer.material.color = Color.Lerp(centerPointMeshRenderer.material.color, GeneralTable.GetColor(GeneralTable.Type.White), cumulativeTime / colorLerpPeriod); if (cumulativeTime / colorLerpPeriod >= 1) { blackFlag = false; } } }
// Use this for initialization void Start() { Reset(); GamePlayManager.OnGameStart += Reset; centerPointMeshRenderer.material.color = GeneralTable.GetColor(GeneralTable.Type.White); }