Inheritance: MonoBehaviour
Exemple #1
0
 void OnTriggerEnter()
 {
     TimerDisplay.stopTimer();
     PlayerPrefs.SetFloat("EndTime", TimerDisplay.globaltime);
     PlayerPrefs.SetInt("New", 100);
     Application.LoadLevel(Scences.EndScreen);
 }
Exemple #2
0
    private void Awake()
    {
        Instance = this;

        timer    = GetComponent <Timer>();
        textMesh = GetComponent <TextMeshProUGUI>();
    }
Exemple #3
0
		private void ImPlayingButtonClickEventHandler(object sender, RoutedEventArgs e)
		{
			TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;
			TaskbarItemInfo.ProgressValue = 0;
			_timerMode = TimerMode.Play;
			TimerDisplay.Invoke(x => x.ResetWorkTimer());
		}
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        comp_spawner     = GetComponent <ObjectSpawner>();
        comp_gameOver    = GetComponent <GameOverMenu>();
        comp_timeDisplay = GetComponent <TimerDisplay>();

        for (int i = 0; i < obstacles_num; i++)
        {
            comp_spawner.SpawnObjects(1, obstacles_array[Random.Range(0, obstacles_array.Length)]);
        }


        comp_spawner.SpawnObjects(cow_num, cow_obj);
        comp_spawner.SpawnObjects(1, farmer_obj);

        bonus_TimeTarget = (float)bonus_everySecs;
        bonus_Text.gameObject.SetActive(false);


        enabled = false;


        if (GetComponent <Countdown>())
        {
            GetComponent <Countdown>().StartCountdown(delegate {
                StartTheGamePlay();
            });
        }
        else
        {
            StartTheGamePlay();
        }
    }
Exemple #5
0
        /// <summary>
        /// Permet d'afficher un texte donné dans une couleur donnée pendant un temps donné. Après quoi le texte et la couelru d'origine seront rétablis.
        /// </summary>
        /// <param name="text">Texte à afficher momentanément</param>
        /// <param name="during">Durée d'affichage du texte (ms)</param>
        /// <param name="color">Couleur du texte affiché momentanément</param>
        public void ShowText(String text, int during = 2000, Color?color = null)
        {
            PreviousColor = ForeColor;
            PreviousText  = Text;

            if (color.HasValue)
            {
                ForeColor = color.Value;
            }

            Text = text;

            if (TimerDisplay != null)
            {
                if (TimerDisplay.Enabled)
                {
                    TimerDisplay.Stop();
                }
                TimerDisplay.Dispose();
            }

            TimerDisplay          = new Timer();
            TimerDisplay.Interval = during;
            TimerDisplay.Tick    += new EventHandler(TimerDisplay_Tick);
            TimerDisplay.Enabled  = true;
            TimerDisplay.Start();
        }
Exemple #6
0
 void TimerDisplay_Tick(object sender, EventArgs e)
 {
     ForeColor = PreviousColor;
     Text      = PreviousText;
     TimerDisplay.Stop();
     Text = "";
 }
Exemple #7
0
 void Start()
 {
     isPaused = false;
     canPause = false;
     time     = GameObject.Find("Timer").GetComponent <TimerDisplay>();
     raceSet  = GameObject.Find("raceSet");
     trackingScoreIncaseOfRestart = ScoreDisplay.score;
 }
Exemple #8
0
        void difficulty(object sender, int Mines, Size size)
        {
            ignore = false;
            Random random = new Random();

            timer1.Enabled = false;
            ResetDisplay(TimerDisplay);
            TimerDisplay.Refresh();
            MNU_Beginner.Checked     = false;
            MNU_Intermediate.Checked = false;
            MNU_Expert.Checked       = false;
            MNU_Custom.Checked       = false;
            UpdateMines(Mines);
            ((MenuItem)sender).Checked = true;
            changeDim(size.Height, size.Width);
            Settings.Default.StartSize  = size;
            Settings.Default.StartMines = Mines;
            Settings.Default.Save();
            counter = 0;
            for (int y = 0; y < size.Height; y++)
            {
                for (int x = 0; x < size.Width; x++)
                {
                    GameTableArray[x, y] = State.Empty;
                }
            }

            for (int i = 0; i < Settings.Default.StartMines; i++)
            {
                int x, y;
                do
                {
                    y = 0;
                    x = random.Next(0, (size.Height * size.Width) - 1);
                    while (x >= size.Width)
                    {
                        y++;
                        x -= size.Width;
                    }
                } while (GameTableArray[x, y] == State.Mine);
                GameTableArray[x, y] = State.Mine;
            }

            for (int y = 0; y < size.Height; y++)
            {
                for (int x = 0; x < size.Width; x++)
                {
                    if (GameTableArray[x, y] != State.Mine)
                    {
                        GameTableArray[x, y] = (State)placeNumber(new Point(x, y), size);
                    }
                }
            }
        }
 protected void OnEnable()
 {
     m = GetComponent<Missile>();
     td = FindObjectOfType<TimerDisplay>();
     timerReadout = td.wir;
     rigid = GetComponent<Rigidbody2D>();
     timer = 0;
     if (td.control != null)
         td.control.IsVisible = false;
     timerActive = true;
     if(RadarController.RC != null)
         RadarController.RC.radar.target = this.gameObject;
 }
Exemple #10
0
    IEnumerator GameOverPart2()
    {
        yield return(new WaitForSeconds(2.0f));

        float highscore = float.Parse(BLINDED_SaveData.GetValue("playerBestTime", "0")) / 100.0f;

        comp_gameOver.Show(TimerDisplay.MakeTimeString(time_duration), TimerDisplay.MakeTimeString(highscore), extra_Life != null);

        if (time_duration > highscore)
        {
            BLINDED_SaveData.SetValue("playerBestTime", Mathf.FloorToInt(time_duration * 100.0f).ToString());
        }
    }
    //////////////////////////////////////////
    /// CreateTimerDisplay()
    /// Static function that will init a
    /// timer display off of an incoming
    /// game object.  For convenience.
    //////////////////////////////////////////
    public static void CreateTimerDisplay(GameObject i_go, float i_fTime, string i_strText)
    {
        TimerDisplay timer = i_go.GetComponent <TimerDisplay>();

        if (timer)
        {
            timer.Init(i_fTime, i_strText);
        }
        else
        {
            Debug.Log("No such timer on " + i_go.name, i_go);
        }
    }
Exemple #12
0
        void Awake()
        {
            _timerDisplay = CreateGameObject.CreateChildGameObject <TimerDisplay>(transform).GetComponent <TimerDisplay>();
            VictoryScreen = CreateGameObject.CreateChildGameObject <VictoryScreen>(transform).GetComponent <VictoryScreen>();
            DefeatScreen  = CreateGameObject.CreateChildGameObject <DefeatScreen>(transform).GetComponent <DefeatScreen>();
            PauseMenu     = CreateGameObject.CreateChildGameObject <PauseMenu>(transform).GetComponent <PauseMenu>();
            PlayerData    = FindObjectOfType <Player>();

            _floatingTextDisplay = CreateGameObject.CreateChildGameObject <FloatingTextDisplay>(transform).GetComponent <FloatingTextDisplay>();
            _chargeBar           = CreateGameObject.CreateChildGameObject <ChargeBar>(transform).GetComponent <ChargeBar>();
            _healthBar           = CreateGameObject.CreateChildGameObject <HealthBar>(transform).GetComponent <HealthBar>();
            _bestTimeDisplay     = CreateGameObject.CreateChildGameObject <BestTimeDisplay>(transform).GetComponent <BestTimeDisplay>();
        }
Exemple #13
0
    public virtual void SetupGame()
    {
        gameManager = GameManager.Instance;
        gameManager.LoadMap(initialMapPrefab);
        gameManager.CreatePlayers();
        SetupPlayers();

        killTracker  = new KillTracker();
        scoreTracker = new ScoreTracker();

        GameObject canvas = GameObject.Find("Canvas");

        timerDisplay = Instantiate(timerDisplayPrefab).GetComponent <TimerDisplay>();
        RectTransform timerTransform = timerDisplay.GetComponent <RectTransform>();

        timerDisplay.transform.SetParent(canvas.transform);
        timerDisplay.transform.localScale = Vector2.one;
        timerTransform.anchoredPosition   = new Vector2(0, -40);
    }
Exemple #14
0
		private void InitialiseTimer()
		{
			_timerMode = TimerMode.Rest;

			var timer = new DispatcherTimer();
			timer.Interval = _oneSecond;
			timer.Tick += (sender, e) =>
			              	{
			              		switch (_timerMode)
			              		{
			              			case TimerMode.Work:
			              				TimerDisplay.Invoke(x => x.Increment());
			              				break;
			              			case TimerMode.Play:
			              				TimerDisplay.Invoke(x => x.Decrement());
			              				break;
			              		}
			              	};
			timer.Start();
		}
Exemple #15
0
    public string GetLostFocusTime()
    {
        string strTime = TimerDisplay.OutReadableTime(m_fLostFocusTime);

        return(strTime);
    }
Exemple #16
0
 void Awake()
 {
     Me = this;
 }
Exemple #17
0
 public void DecorateDoor(int index, int time, int collectibles)
 {
     doors[index].transform.GetChild(0).GetComponent <Text>().text = TimerDisplay.HumanTime(time);
     doors[index].transform.GetChild(1).GetComponent <Text>().text = "" + collectibles;
 }
Exemple #18
0
    // Use this for initialization
    void Start()
    {
        comp_leaderboard = GetComponent <FacebookFriendLeaderboard>();

        Text_bestscore.text = TimerDisplay.MakeTimeString(float.Parse(BLINDED_SaveData.GetValue("playerBestTime", "0")) / 100.0f);
    }
Exemple #19
0
 public static void initialTime()
 {
     StartTime = PlayerPrefs.GetFloat("time");
     TimerDisplay.startTime = StartTime;
     TimerDisplay.startTimer();
 }
Exemple #20
0
 public static void startTime()
 {
     StartTime = Time.time;
     TimerDisplay.startTime = StartTime;
     TimerDisplay.startTimer();
 }
	void Start(){
		InvokeRepeating("updateTimer", 0f, 0.1f);
		unitActingQueue = GetComponentInChildren<UnitActingQueue>();
		if(timer == null){
			timer = GameObject.Find("Unit Timer").GetComponent<TimerDisplay>();
		}
	}
 public TimerController(TimerDisplay view)
 {
     this.view = view;
     EventManager.Instance.onTimerUpdated += view.SetText;
 }