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); } }
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); }