void Awake() //The default initialization of the panel { panel = gameObject; ResetSideFrames = GameController.FrameRate * 20; ResetPanelFrames = GameController.FrameRate * 20; panelCord = panel.transform.position; condition = Condition.NORMAL; PanelFrames = 0; if (column < 4) //sets side colors { startSide = FieldSide.RED; altSide = FieldSide.BLUE; sideColorDefault = Color.red; sideColorAlt = Color.blue; } else { startSide = FieldSide.BLUE; altSide = FieldSide.RED; sideColorDefault = Color.blue; sideColorAlt = Color.red; } gameObject.GetComponent <Renderer> ().material.color = sideColorDefault; maxLoad = 2; side = startSide; sideFrames = 0; }
void PanelOperations() // resets panels to normal after a while { if (side != startSide) { gameObject.GetComponent <Renderer> ().material.color = sideColorAlt; side = altSide; if (sideFrames >= ResetSideFrames) { side = startSide; sideFrames = 0; gameObject.GetComponent <Renderer> ().material.color = sideColorDefault; } else { sideFrames++; } } if (PanelFrames >= ResetPanelFrames) //Resets panel condition { condition = Condition.NORMAL; Color tColor = GetComponent <Renderer> ().material.color; tColor.a = 1f; GetComponent <Renderer> ().material.color = tColor; PanelFrames = 0; } else { PanelFrames++; } switch (condition) { case Condition.NORMAL: AlphaChanger(1f); maxLoad = 2; break; case Condition.CRACKED: AlphaChanger(0.5f); maxLoad = 2; break; case Condition.BROKEN: AlphaChanger(0f); maxLoad = 1; break; default: AlphaChanger(1f); maxLoad = 2; break; } if (condition == Condition.BROKEN) { GetComponent <Collider> ().enabled = false; } else { GetComponent <Collider> ().enabled = true; } } //Has the panel reset itself and it's frames
public void Initialize(FieldSide fieldSide) { FieldSide = fieldSide; }
public void AssignFieldSide(FieldSide fieldSide) { LogEx.Log <Player>("{0} assigned to field {1}", name, fieldSide.ID); FieldSide = fieldSide; }