// Use this for initialization void Start() { commandTimeText = GameObject.Find("CommandTime").GetComponent <Text>(); timeButton = FindObjectOfType <TimeButton>(); commandTimeText.enabled = false; actionGauge = GameObject.Find("ActionGauge").GetComponent <Slider>(); }
private void Awake() { anim = GetComponent <Animation>(); inputPlaceholderText = issueInput.placeholder.GetComponent <Text>(); for (int hour = 0; hour < NUMBER_OF_HOURS; ++hour) { Button newButton = Instantiate(buttonPrototype, hoursContainer) as Button; TimeButton timeButton = newButton.GetComponent <TimeButton>(); string formattedHour = hour.ToString("D2"); timeButton.Name = formattedHour; timeButton.ButtonText = formattedHour; newButton.onClick.AddListener(() => TaskForHourButtons(hour)); } for (int minute = 0; minute < NUMBER_OF_MINUTES; ++minute) { Button newButton = Instantiate(buttonPrototype, minutesContainer) as Button; TimeButton timeButton = newButton.GetComponent <TimeButton>(); string formattedMinute = minute.ToString("D2"); timeButton.Name = formattedMinute; timeButton.ButtonText = formattedMinute; newButton.onClick.AddListener(() => TaskForMinuteButtons(minute)); } }
public void ButtonClicked(TimeButton button) { if (pressedButton == button) { if (button.SpeedType == MyEnums.GameSpeed.Pause) { PressOffButtons(); var b = buttonsList.FirstOrDefault(x => x.SpeedType == gameSpeed); if (b != null) { b.PressOn(); pressedButton = b; } GameSpeed = gameSpeed; } else { return; } } else { PressOffButtons(); button.PressOn(); pressedButton = button; GameSpeed = button.SpeedType; } }
public void Subscribe(TimeButton button) { buttonsList.Add(button); if (button.SpeedType == MyEnums.GameSpeed.Normal) { button.PressOn(); pressedButton = button; } }
// Use this for initialization void Start() { timeButton = Instantiate(Resources.Load <GameObject>("Prefab/TimeButton")).GetComponent <TimeButton>(); commandTimeText = GameObject.Find("CommandTime").GetComponent <Text>(); timeButton = FindObjectOfType <TimeButton>(); commandTimeText.enabled = false; actionGauge = GameObject.Find("ActionGauge").GetComponent <Slider>(); displayScoreText = GameObject.Find("DisplayScore").GetComponent <Text>(); totalScoreText = GameObject.Find("TotalScore").GetComponent <Text>(); audioSource = GetComponent <AudioSource>(); }
void Start() { _instance = this; }