IGameTimer setupTimer(float maxTime, float timeStep) { GameObject timerObject = new GameObject(); MonoTimer timer = timerObject.AddComponent <MonoTimer>(); return(timer.Setup(maxTime, timeStep)); }
public void Start() { Instance = this; timer = gameObject.GetComponent <MonoTimer>(); client = new HttpClient(); LoginPanel = GameObject.Find("LoginPanel"); usernameInput = GameObject.Find("UserNameInput").GetComponent <InputField>(); passwordInput = GameObject.Find("PasswordInput").GetComponent <InputField>(); infoLabel = GameObject.Find("InfoLabel").GetComponent <Text>(); PlayerPanel = GameObject.Find("PlayerPanel"); PlayerScroll = GameObject.Find("PlayerScroll").GetComponent <ScrollRect>(); createLabel = GameObject.Find("CreateLabel").GetComponent <Text>(); playerNameInput = GameObject.Find("PlayerNameInput").GetComponent <InputField>(); LoadingPanel = GameObject.Find("LoadingPanel"); LoginButton.onClick.AddListener(Login); RegisterButton.onClick.AddListener(Register); QuitGameButton.onClick.AddListener(QuitGame); CreateButton.onClick.AddListener(Create); BackButton.onClick.AddListener(Back); LoginPanel.SetActive(true); PlayerPanel.SetActive(false); LoadingPanel.SetActive(false); }
public static MonoTimer Init() { if (m_Instance == null) { GameObject go = new GameObject("MonoTimer"); m_Instance = go.AddComponent <MonoTimer>(); DontDestroyOnLoad(go); } return(m_Instance); }
private void Awake() { if (Usersession.Instance != null) { CurrentPlayer = Usersession.Instance.player; } Timer = gameObject.AddComponent <MonoTimer>(); Screen.SetResolution(800, 600, false); inputController = gameObject.AddComponent <InputController>(); Instance = this; }
private void FixedUpdate() { GameObject fader = Instantiate(prefabTrail); fader.transform.position = trans.position; fader.transform.rotation = trans.rotation; fader.transform.localScale = trans.lossyScale; fader.GetComponent <SpriteRenderer>().sprite = accessor.Get(); MonoTimer fadeTimer = fader.GetComponent <MonoTimer>(); fadeTimer.SetSecondsTarget(secondsToFade); fadeTimer.Run(); }