Inheritance: MonoBehaviour
コード例 #1
0
 void Start()
 {
     m_EnemyManager = GetComponent <EnemyManager>();
     m_TimeCounter  = GetComponent <TimeCounter>();
     PrepareToPlay();
     //Time.timeScale = 0.1f;
 }
コード例 #2
0
        protected override void LoadPayload(string payload)
        {
            try
            {
                var newHostConfig = AdaptiveHostConfig.FromJsonString(payload).HostConfig;

                if (newHostConfig != null)
                {
                    HostConfig = newHostConfig;

                    HostConfigChanged?.Invoke(this, HostConfig);

                    errors = new List <ErrorViewModel>();
                    TimeCounter.ResetCounter();
                }
                else
                {
                    SetSingleError(new ErrorViewModel()
                    {
                        Message = "Invalid Host Config payload",
                        Type    = ErrorViewModelType.ErrorButRenderAllowed
                    });
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                SetSingleError(new ErrorViewModel()
                {
                    Message = ex.ToString(),
                    Type    = ErrorViewModelType.ErrorButRenderAllowed
                });
            }
        }
コード例 #3
0
	// Use this for initialization
	void Start () 
	{
		//assigns to main camera if no other camera is assigned before hand.
		if(cam==null)
			cam=Camera.main;
		
		//access scorecounter script.	
		scorecount = GameObject.Find("GameController").GetComponent<Scorecount>();
		
		//access timecounter script.
		timecounter = GameObject.Find("GameController").GetComponent<TimeCounter>();
	
		//access highscore script.
		highscore = GameObject.Find("GameController").GetComponent<HighScore>();
		
		//stores the screenlimits in the form of a vector.
		Vector3 screenlimit = new Vector3(Screen.width,Screen.height,0f);
		
		//converts screen limits into world limits and stores it in the form of a vector.
		Vector3 worldlimit = cam.ScreenToWorldPoint(screenlimit);
		
		//(-1.1f) so that the entire pumpkin lies inside the screen.
		maxwidth = worldlimit.x - 1.1f;
	
	}
コード例 #4
0
 private void Start()
 {
     playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
     playerBehaviour = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviour>();
     TimeCounter.TimeReset();
     gameIsActive = true;
 }
コード例 #5
0
 public void Dispose()
 {
     ValentinesDay.Dispose();
     TimeCounter.Dispose();
     ConsoleKey.Dispose();
     Random.Dispose();
 }
コード例 #6
0
ファイル: Main.cs プロジェクト: adamtal3/PunchClock
        public Main()
        {
            InitializeComponent();

            // Material
            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);

            // Notify icon
            niNotifyIcon.ContextMenu = new ContextMenu(new[] {
                new MenuItem("Show", (sender, args) => { this.niNotifyIcon_MouseDoubleClick(sender, null); }),
                new MenuItem("-"),
                new MenuItem("Exit", (sender, args) => { this.Close(); })
            });

            // Scroll Lock handler
            ScrollLockInterceptor.ScrollLockChange += ScrollLockInterceptorOnScrollLockChange;

            _timer = new Timer {
                Interval = 10000
            };
            _timer.Tick += (sender, args) => ScrollLockInterceptor.InvokeScrollLockChange();
            _timer.Start();

            _timeCounter = new TimeCounter();
        }
コード例 #7
0
    private void AssignComponents()
    {
        if (targetTransform == null)
        {
            targetTransform = GameObject.FindGameObjectWithTag(Tags.Player).transform;
        }

        if (inputManager == null)
        {
            inputManager = GetComponent <InputManager>();
        }

        if (spawnManager == null)
        {
            spawnManager = GetComponent <SpawnManager>();
        }

        if (timer == null)
        {
            timer = GetComponent <Timer>();
        }

        if (timeCounter == null)
        {
            timeCounter = GetComponent <TimeCounter>();
        }
    }
コード例 #8
0
    private void UmbrellaControl()
    {
        if ((State == Utils.HumanState.isShooting ||
             State == Utils.HumanState.isPreparingToShoot) &&
            !IsOpenUmbrella)
        {
            SecondsForUmbrella += TimeCounter.CountSeconds();
        }

        else if ((State == Utils.HumanState.immutable ||
                  State == Utils.HumanState.isbackingToCover) ||
                 IsOpenUmbrella)
        {
            SecondsForUmbrella -= TimeCounter.CountSeconds();
        }

        if (SecondsForUmbrella >= openUmbrellaSeconds)
        {
            OpenUmbrella();
        }

        if (SecondsForUmbrella <= 0)
        {
            CloseUmbrella();
        }
    }
コード例 #9
0
ファイル: SimpleExample.cs プロジェクト: zz110/WindowTabs
 private void button1_Click(object sender, EventArgs e)
 {
     TimeCounter.Start();
     _tree.FullUpdate();
     //_model.Root.Nodes[0].Text = "Child";
     button1.Text = TimeCounter.Finish().ToString();
 }
コード例 #10
0
        public TimeCounter Update(TimeCounter entity)
        {
            context.Entry(entity).State = EntityState.Modified;
            context.SaveChanges();

            return(entity);
        }
コード例 #11
0
ファイル: Timer.cs プロジェクト: rouchen/UnityDemo
 /// <summary>
 /// 刪除每秒回呼函式
 /// </summary>
 /// <param name="timeName">計時器名稱</param>
 /// <param name="callBack">回呼函式</param>
 public void DeleteEverySecondCallBack(string timeName, TimeCounter.TimeCallBack callBack)
 {
     if (timerCounterDic.ContainsKey(timeName))
     {
         timerCounterDic[timeName].everySecondCallBack -= callBack;
     }
 }
コード例 #12
0
        protected virtual void Awake()
        {
            this.Info("Awake()");

            // 初始化
            if (false == this.InitInfo())
            {
                return;
            }

            // 产品列表
            if (false == this.initProducts())
            {
                return;
            }

            // IAP实例
            if (false == this.initIAPInstance())
            {
                return;
            }
            this._IAPInstance.StartProcessing();

            // 时间计数器初始化
            this._timeCounter = TimeCounter.Create(
                this._timeoutMaxValue, OnTimeCounterCountOver);
        }
コード例 #13
0
	// Use this for initialization
	void Start () 
	{
		//checks for camera and assigns main camera if no camera assigned earlier.
		if(cam==null)
			cam=Camera.main;
		
		//acess TimeCounter script.	
		timecounter = gameObject.GetComponent<TimeCounter>();
		
		//acess HighScore Script.
		highscore = gameObject.GetComponent<HighScore>();
		
		//stores the screen limits in a vector.
		Vector3 screenlimit = new Vector3(Screen.width,Screen.height,0f);
		
		//converts screen limits to world limits and stores it in a vector.
		Vector3 worldlimit = cam.ScreenToWorldPoint(screenlimit);
		
		//(-0.9f),so that candies are spawned inside the screenlimit.
		maxwidth = worldlimit.x - 0.9f;
		
		//display instructions before game starts.
		instruction.enabled=true;
		
		//begin spawning candies and other GOs. 
		StartCoroutine("spawn");
	}
コード例 #14
0
    void Start()
    {
        var txt = GameObject.Find("TIMERcanvas");

        timeCounter = txt.GetComponent <TimeCounter>();

        if (timeCounter.Seconds > 0)
        {
            _bestTime = PlayerPrefs.GetInt("Time");

            if (timeCounter.Seconds < _bestTime)
            {
                //New HighScore
                _bestTime = timeCounter.Seconds;
                PlayerPrefs.SetInt("Time", _bestTime);
            }
        }
        else
        {
            _bestTime = PlayerPrefs.GetInt("Time");
        }

        HighScoreText.text = "NEW HIGHSCORE: " + _bestTime + " !";

        GenericWindow.Manager = this;
        Open(DefaultWindowID);
    }
コード例 #15
0
    public void Start()
    {
        timeCounter = GameObject.FindGameObjectWithTag("TIME").GetComponent <TimeCounter>();
        playerVida  = GameObject.FindGameObjectWithTag("Player").GetComponent <PLAYER_VIDA>();

        destroy = false;
    }
コード例 #16
0
    void Start()
    {
        Time.timeScale = 1.0f;

        manager     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GameManager>();
        timeCounter = GetComponent <TimeCounter>();

        backgroundMusicSource = manager.backgroundMusicSource;
        gameSoundsSource      = manager.gameSoundsSource;
        gameSoundsSource1     = manager.gameSoundsSource1;

        pauseScreen.gameObject.SetActive(false);
        sliders.gameObject.SetActive(false);
        menu.gameObject.SetActive(false);
        loseScreen.gameObject.SetActive(false);
        winScreen.gameObject.SetActive(false);
        tryAgain.gameObject.SetActive(false);
        scoreValue.gameObject.SetActive(false);
        savedInfo.SetActive(false);

        sliderMusic.value  = 0.6f;
        sliderSounds.value = 0.6f;

        resume.onClick.AddListener(Resume);
        menu.onClick.AddListener(GoToMenu);
        tryAgain.onClick.AddListener(RestartLevel);
        saveScoreButton.onClick.AddListener(SaveScore);

        lives3.SetActive(true);
        lives2.SetActive(true);
        lives1.SetActive(true);
        lives = 3;

        isScoreSaved = false;
    }
コード例 #17
0
    // Use this for initialization
    void Start()
    {
        timeManager = TimeManager.GetInstance();
        components  = GetComponent <Components>();

        timeCounter = components.GetTimeCounter();
    }
コード例 #18
0
 public Controller()
 {
     warehouse   = new Warehouse(this);
     outputView  = new OutputView(warehouse);
     inputView   = new InputView(this);
     TimeCounter = new TimeCounter(5000, 1000, this);
 }
コード例 #19
0
 private void Awake()
 {
     audiosource = GetComponent <AudioSource>();
     timeCounter = FindObjectOfType <TimeCounter>();
     controller  = FindObjectOfType <GameController>();
     main        = FindObjectOfType <Main>();
 }
コード例 #20
0
 /*/ Sets game to inactive, while level completed, sets new player score and shows game result /*/
 private void CompleteLevel()
 {
     gameIsActive = false;
     playerBehaviour.AddToPlayerScore(finishMeters[currentLevel]);
     playerBehaviour.SubtractPlayerScore((TimeCounter.TotalTime() * penaltyMultiplierForTime[currentLevel]));
     currentLevel++;
     if (currentLevel < finishMeters.Length)
     {
         levelComplete.SetActive(true);
         if (PlayerBehaviour.coinsCollected == 0)
         {
             playerScore.text = "Current Score: " + PlayerBehaviour.totalScore.ToString();
         }
         else
         {
             int bonus = MoneyBehaviour.coinMultiplier * PlayerBehaviour.coinsCollected;
             playerScore.text = "Current Score: " + PlayerBehaviour.totalScore.ToString() + "\n      Bonus for coins: " + bonus + "   Total: " + (PlayerBehaviour.totalScore + bonus).ToString();
             playerBehaviour.AddToPlayerScore(bonus);
         }
         Invoke("Restart", 5.0f);
     }
     else
     {
         gameComplete.SetActive(true);
         int bonus = MoneyBehaviour.coinMultiplier * PlayerBehaviour.coinsCollected;
         finishText.text = "Final Score: " + PlayerBehaviour.totalScore.ToString() + "\n      Bonus for coins: " + bonus + "   Total: " + (PlayerBehaviour.totalScore + bonus).ToString();
         playerBehaviour.AddToPlayerScore(bonus);
     }
 }
コード例 #21
0
        public ProfileSummaryModel CreateProfile(Customer customer, CreditBureauModel creditBureau, CompanyScoreModel companyScore)
        {
            TimeCounter tc      = new TimeCounter("ProfileSummaryModel 1 building time for customer " + customer.Id);
            var         summary = new ProfileSummaryModel();

            using (tc.AddStep("BuildCustomerSummary Time taken")) {
                BuildCustomerSummary(summary, customer);
            }
            using (tc.AddStep("BuildCreditBureau Time taken")) {
                BuildCreditBureau(customer, summary, creditBureau);
            }
            using (tc.AddStep("AddDecisionHistory Time taken")) {
                AddDecisionHistory(summary, customer);
            }
            using (tc.AddStep("BuildRequestedLoan Time taken")) {
                BuildRequestedLoan(summary, customer);
            }
            using (tc.AddStep("BuildAlerts Time taken")) {
                BuildAlerts(summary, customer);
            }
            using (tc.AddStep("BuildCompaniesHouseAlerts Time taken")) {
                BuildCompaniesHouseAlerts(summary, companyScore);
            }
            log.Info(tc.ToString());
            return(summary);
        }
コード例 #22
0
    /******************************************
    *                                         *
    *               SCENE SECTION             *
    *                                         *
    ******************************************/
    public void ChangeScene(string scene_name)
    {
        AR_mode = false;
        if (scene_name == Constants.MAIN_GAME_SCENE)
        {
            time_counter = null;
            ClearLists(true);

            SceneManager.LoadScene(Constants.MAIN_GAME_SCENE);

#if UNITY_ANDROID || UNITY_IOS
            SceneManager.LoadSceneAsync(Constants.AR_SCENE, LoadSceneMode.Additive);
#endif
            StartOver();
        }
        else if (scene_name == Constants.PENALTY_GAME_SCENE)
        {
            time_counter = null;
            ClearLists(true);

            SceneManager.LoadScene(Constants.PENALTY_GAME_SCENE);

#if UNITY_ANDROID || UNITY_IOS
            SceneManager.LoadSceneAsync(Constants.AR_SCENE, LoadSceneMode.Additive);
#endif
            StartPenalty();
        }
        else if (scene_name == Constants.MENU_SCENE)
        {
            SceneManager.LoadScene(Constants.MENU_SCENE);
        }
    }
コード例 #23
0
            public void Analyze()
            {
                Console.WriteLine("CallGraphAnalyzer");

                TimeCounter OverallAnalysisTime = new TimeCounter();

                OverallAnalysisTime.Start();

                Set <string> beingAnalyzed = new Set <string>();

                foreach (string assembly in options.Assemblies)
                {
                    beingAnalyzed.Add(Path.GetFileNameWithoutExtension(assembly));
                }
                callgraph = new CallGraph <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly>(this.mdDecoder, beingAnalyzed);

                foreach (string assembly in options.Assemblies)
                {
                    AnalyzeAssembly(assembly);
                }

                callgraph.EmitDotFile(options.OutputFile);

                OverallAnalysisTime.Stop();

                Console.WriteLine("Total time {0}.", OverallAnalysisTime.ToString());
            }
コード例 #24
0
        private void _load2_Click(object sender, EventArgs e)
        {
            label5.Text = "Working";
            Application.DoEvents();

            _treeView2.Nodes.Clear();

            TimeCounter.Start();
            _treeView2.BeginUpdate();

            List <TreeNode> list = new List <TreeNode>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(new TreeNode(i.ToString()));
                for (int n = 0; n < 500; n++)
                {
                    list[i].Nodes.Add(n.ToString());
                    for (int k = 0; k < 5; k++)
                    {
                        list[i].Nodes[n].Nodes.Add(k.ToString());
                    }
                }
            }
            _treeView2.Nodes.AddRange(list.ToArray());

            _treeView2.EndUpdate();
            label5.Text = TimeCounter.Finish().ToString();
        }
コード例 #25
0
ファイル: PerformanceTest.cs プロジェクト: zz110/WindowTabs
        private void _load_Click(object sender, EventArgs e)
        {
            label3.Text = "Working";
            Application.DoEvents();

            _treeView.Model = null;
            _model          = null;
            GC.Collect(3);

            TimeCounter.Start();

            _model = new TreeModel();
            for (int i = 0; i < 10; i++)
            {
                _model.Root.Nodes.Add(new Node(i.ToString()));
                for (int n = 0; n < 500; n++)
                {
                    _model.Root.Nodes[i].Nodes.Add(new Node(n.ToString()));
                    for (int k = 0; k < 5; k++)
                    {
                        _model.Root.Nodes[i].Nodes[n].Nodes.Add(new Node(k.ToString()));
                    }
                }
            }

            _treeView.Model = _model;

            label3.Text = TimeCounter.Finish().ToString();
        }
コード例 #26
0
ファイル: Match.cs プロジェクト: oopartians/STARPOO
    public static void DamageToAllShips(float damage)
    {
        TimeCounter.ReSetBoringTime();
        List <Ship> tmpShips = new List <Ship> ();

        foreach (Team team in teams)
        {
            foreach (Fleet fleet in team.fleets)
            {
                foreach (Ship ship in fleet.ships)
                {
                    tmpShips.Add(ship);
                    if (ship.hp <= damage)
                    {
                        ship.destroyedByTimePenalty = true;
                        ship.gameObject.GetComponent <LightningEffect>().Show();
                        if (fleet.ships.Count <= 1)
                        {
                            fleet.destroyedByTimePenalty = true;
                            if (fleet.team.fleets.Count == fleet.team.destroyedfleetcount + 1)
                            {
                                fleet.team.destroyedByTimePenalty = true;
                            }
                        }
                    }
                    break;
                }
            }
        }
        foreach (Ship ship in tmpShips)
        {
            ship.Damage(damage);
            ship.gameObject.GetComponent <LightningEffect>().Show();
        }
    }
コード例 #27
0
        public TimeCounter Create(TimeCounter entity)
        {
            context.TimeCounters.Add(entity);
            context.SaveChanges();

            return(entity);
        }
コード例 #28
0
ファイル: Timer.cs プロジェクト: rouchen/UnityDemo
 /// <summary>
 /// 加入時間到回呼函式
 /// </summary>
 /// <param name="timeName">計時器名稱</param>
 /// <param name="callBack">回呼函式</param>
 public void AddTimeUpCallBack(string timeName, TimeCounter.TimeCallBack callBack)
 {
     if (timerCounterDic.ContainsKey(timeName))
     {
         timerCounterDic[timeName].timeUpCallBack += callBack;
     }
 }
コード例 #29
0
 public void SetTime()
 {
     if (time)
     {
         time.text = TimeCounter.GetTime();
     }
 }
コード例 #30
0
    //セーブ
    public void Save(int SaveNum)
    {
        PlData = GetComponent <PlayerData>();
        TimeCounter tc   = GetComponent <TimeCounter>();
        SaveData    sd   = new SaveData();
        string      json = "";

        if (SaveNum != -1)
        {
            sd.money      = PlData.money;
            sd.days       = tc.GetTime().day;
            sd.hour       = tc.GetTime().hour;
            sd.second     = tc.GetTime().second;
            sd.itemvalues = GetComponent <ItemManager>().GetSaveItem();
            sd.ItemIsGet  = GetComponent <ItemManager>().GetSaveItemIsget();
            sd.plantN     = GetComponent <Planter>().GetPlantN();
            sd.plantG     = GetComponent <Planter>().GetPlantG();
            json          = JsonUtility.ToJson(sd);
            am.PlaySE(am.SE[3]);
        }
        else
        {
            json = JsonUtility.ToJson(GetComponent <Option>().GetConfigData());
        }
        File.WriteAllText(GetFileName(SaveNum), json);
        if (type == SLType.Save)
        {
            DonePanel.SetActive(true);
        }
        pos = NowPosition.Done;
    }
コード例 #31
0
 private void Start()
 {
     LevelManager.currentLevel      = 0;
     PlayerBehaviour.totalScore     = 0;
     PlayerBehaviour.coinsCollected = 0;
     PauseScript.gamePaused         = false;
     TimeCounter.TimeReset();
 }
コード例 #32
0
ファイル: Player.cs プロジェクト: kof1016/DataFlow
 public Player(ISoulBinder binder, Guid id, int character, bool main_player)
 {
     _Binder     = binder;
     Id          = id;
     Character   = character;
     _MainPlayer = main_player;
     _Counter    = new TimeCounter();
 }
コード例 #33
0
 public ExploreStatus(IBinder binder, Entity player, IMapFinder map, Guid target_id)
 {
     _Binder    = binder;
     _Player    = player;
     _Map       = map;
     _TargetId  = target_id;
     _CastTimer = new TimeCounter();
 }
コード例 #34
0
 void Start()
 {
     this.lifeManager = GameObject.FindObjectOfType <LifeManager>();
     joystick         = GameObject.FindObjectOfType <VirtualJoystick>();
     audioSource      = GetComponent <AudioSource>();
     timeCounter      = GameObject.FindObjectOfType <TimeCounter>();
     timeCounter.resetTime();
 }
コード例 #35
0
ファイル: PowerRegulator.cs プロジェクト: jiowchern/Regulus
 public PowerRegulator()
 {
     _Sample = 1.0f;
     _SpinWait = new SpinWait();
     _SpinCount = 0;
     _WorkCount = 0;
     _Busy = 0;
     _TimeCount = new TimeCounter();
     _FPS = new FPSCounter();
 }
コード例 #36
0
    // Use this for initialization
    void Start()
    {
        _sounds = GameObject.Find("LC").GetComponent<SoundAssets>();
        _dispenser = GameObject.Find("Dispenser").GetComponent<DispenserController>();
        _timeCounter = GetComponent<TimeCounter>();
        var audioSource = _dispenser.gameObject.GetComponent<AudioSource>();
        _lvlText = GameObject.Find("txtLevel").GetComponent<Text>();
        // Find the level text object if it exists and update it with the current level count.
        // Remember: Scenes "0" and "1" are SplashScreen and MainMenu so the first lvl has the index "2"!
        _lvlText.text = "Level " + (Application.loadedLevel - 1);
        audioSource.PlayOneShot(_sounds.LevelStart);

        _secToStart = LevelStartTime;
        StartCoroutine("WaitOne");
    }
コード例 #37
0
ファイル: TestTimeCounter.cs プロジェクト: weimingtom/erica
        public void Test_New_3()
        {
            int interval = 0;

            using (var c = new TimeCounter (5, 0)) {
                c.Elapsed += () => interval += 1;
              c.Start ();

                while (c.IsRunning) {
                    System.Threading.Thread.Sleep (1);
                }
                System.Threading.Thread.Sleep (1);

                Assert.AreEqual (5, c.Count);
                Assert.AreEqual (0, interval);
             }
        }
コード例 #38
0
 public MovementManager(Station firstStation, Station lastStation, Route route, Movement firstMovement, Movement normalMovement, Movement goOutMovement, TrainPassengers passengers, TimeCounter timeCounter, CurrentPoints points, GuiManager gui, GuiRendererControl backToMenuButton, GuiRendererControl showRankingButton, bool isLocal, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network)
 {
     this.firstStation = firstStation;
     this.lastStation = lastStation;
     this.route = route;
     this.movement = firstMovement;
     this.normalMovement = normalMovement;
     this.goOutMovement = goOutMovement;
     this.passengers = passengers;
     this.timeCounter = timeCounter;
     this.points = points;
     this.gui = gui;
     this.backToMenuButton = backToMenuButton;
     this.showRankingButton = showRankingButton;
     this.isLocal = isLocal;
     this.playersPoints = playersPoints;
     this.network = network;
 }
コード例 #39
0
ファイル: CurrentPoints.cs プロジェクト: alvarogzp/nextation
 public CurrentPoints(GameMap map, TrainPassengers passengers, TimeCounter timeCounter)
 {
     this.map = map;
     this.passengers = passengers;
     this.timeCounter = timeCounter;
 }
コード例 #40
0
ファイル: GameProcess2.cs プロジェクト: westernknight/24Taste
    void Start()
    {
        GameObject OperatorButtons = GameObject.Find("OperatorButtons");
        GameObject QuestionButtons = GameObject.Find("QuestionButtons");



        for (int i = 0; i < OperatorButtons.transform.childCount; i++)
        {
            operationButtons.Add(OperatorButtons.transform.GetChild(i).gameObject);
        }
        for (int i = 0; i < QuestionButtons.transform.childCount; i++)
        {
            questionButtons.Add(QuestionButtons.transform.GetChild(i).gameObject);
        }
        typeInText = GameObject.Find("typeInText").GetComponent<Text>();
        answerText = GameObject.Find("answerText").GetComponent<Text>();
        answerText.text = "";
        //birds = GameObject.Find("birds");
        resetButton = GameObject.Find("resetButton");
        typeInText.text = "";
        score = GameObject.Find("score");
        score.GetComponent<Text>().text = "0";

        List<string> l1 = new List<string>() { "+", "-", "x", "/" };
        List<string> l2 = new List<string>() { "+", "-", "x", "/" };
        List<string> l3 = new List<string>() { "+", "-", "x", "/" };
        List<string> l4 = new List<string>() { "+", "-", "x", "/" };
        for (int i = 0; i < l1.Count; i++)
        {
            string tmp = l1[i];
            for (int j = 0; j < l2.Count; j++)
            {
                tmp += l2[j];
                for (int k = 0; k < l3.Count; k++)
                {
                    tmp += l3[k];
                    for (int l = 0; l < l4.Count; l++)
                    {
                        tmp += l4[l];
                        //Debug.Log(tmp);
                        allMethod.Add(tmp);
                        tmp = tmp.Remove(tmp.Length - 1);
                    }

                    tmp = tmp.Remove(tmp.Length - 1);
                }
                tmp = tmp.Remove(tmp.Length - 1);
            }
        }

        for (int i = 0; i < allMethod.Count; i++)
        {
            allMethod[i] = allMethod[i].Remove(allMethod[i].Length - 1);
        }

        timeCounter = GameObject.FindObjectOfType<TimeCounter>();
        timeCounter.timeOutEvent += () =>
        {
            string sz = "(" + "(" + answer.numbers[0] + answer.operators[0] + answer.numbers[1] + ")" + answer.operators[1] + answer.numbers[2] + ")" + answer.operators[2] + answer.numbers[3];
            sz += " = 24";
            answerText.text = sz;
            answerText.color = new Color(255 / 255.0f, 39 / 255.0f, 3 / 255.0f);
            SetButtonToNext();

        };



        ///setting
        if (StartSceneSetting.instance)
        {
            if (StartSceneSetting.instance.level == 0)
            {
                StartSceneSetting.instance.PlayBGM(1);
                GameObject.Find("bk").GetComponent<Image>().overrideSprite = simpleLevelBk;
                GameObject.Find("decorate").GetComponent<Image>().overrideSprite = simpleLevelImage;
            }
            else
            {
                StartSceneSetting.instance.PlayBGM(Random.Range(2, 6));
                GameObject.Find("bk").GetComponent<Image>().overrideSprite = hardLevelBk;
                GameObject.Find("decorate").GetComponent<Image>().overrideSprite = hardLevelImage;
            }
            StartSceneSetting.instance.InitSoundBirds();
            oneQuestionTime = oneQuestionTime * (StartSceneSetting.instance.level + 1);


        }

        GetQuestion();
        SetButtonToReset();
    }
コード例 #41
0
 private void Awake()
 {
     counter = GetComponent<TimeCounter>();
 }
コード例 #42
0
ファイル: Main.cs プロジェクト: alvarogzp/nextation
    private MovementManager getMovementFor(Train train, bool isLocalTrain, NetworkTrainPlayer networkPlayer, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network)
    {
        float rotationSpeed = train.RotationSpeed;
        float translationSpeed = train.TranslationSpeed * GameMapSizeFactor.GetFactorForCurrentMapRelativeToFirstMap();
        int maxPassengers = train.MaxPassengers;
        Transform mover = train.transform.parent ?? train.transform;

        TransformOperations.To(mover).SetRotationTo(FirstStation.transform.position);

        Route route = new Route();
        route.Add(null);
        route.Add(FirstStation);

        if (isLocalTrain) {
            FirstStation.StartHighlight();
        }

        Player player = networkPlayer == null ? PlayerFactory.CreateLocal(train) : networkPlayer;

        TrainPassengersLimit trainPassengersLimit = TrainPassengersLimitFactory.Get(TrainPassengersLimitType);
        trainPassengersLimit.SetLimit(maxPassengers);
        TrainPassengers passengers = new TrainPassengers(trainPassengersLimit, player);

        TimeCounter timeCounter = new TimeCounter();
        timeCounters.Add(timeCounter);

        CurrentPoints points = new CurrentPoints(CurrentMap.GetCurrentMap(), passengers, timeCounter);
        playersPoints.AddPoints(player, points);

        GuiButtonRendererControl backToMenuButton = null;
        GuiButtonRendererControl showRankingButton = null;

        Movement firstMovement, normalMovement, goOutMovement;
        if (isLocalTrain) {
            Camera camera = Camera.main;
            Vector3 cameraOffset = -(mover.position - camera.transform.position);

            firstMovement = new ParallelMovement()
                .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL))
                .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationStartStepType, TERRESTRIAL, cameraOffset));
            //firstMovement.Update(FirstStation.transform.position);

            normalMovement = new SequentialMovement()
                .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL))
                .AddMovement(new ParallelMovement()
                    .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL))
                    .AddMovement(new TranslationMovement(camera.transform, translationSpeed, TranslationDefaultStepType, TERRESTRIAL, cameraOffset)));

            goOutMovement = new SequentialMovement()
                .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL))
                .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL));

            MapCamera trainCamera = new TrainCamera(Camera.main);
            MapCamera freeCamera = new FreeCamera(Camera.main);
            CameraManager cameraManager = new CameraManager(trainCamera);

            backToMenuButton = new GuiButtonRendererControl(() => Application.LoadLevel(SceneNames.MENU));
            showRankingButton = new GuiButtonRendererControl(() => SocialManager.ForegroundActions.ShowLeaderboard(CurrentMap.GetCurrentMap()));
            GuiButtonRendererControl setTrainCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(trainCamera));
            GuiButtonRendererControl setFreeCameraButton = new GuiButtonRendererControl(() => cameraManager.SetCamera(freeCamera));

            gui.AddElement(new GuiHudElement(passengers, timeCounter));
            gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Train\nCam", GuiPosition.DOWN_LEFT, setTrainCameraButton));
            gui.AddElement(GuiElementFactory.GetSwitchCameraElement("Free\nCam", GuiPosition.DOWN_RIGHT, setFreeCameraButton));

            input.AddLocal(route, cameraManager);
            input.AddButtons(backToMenuButton, showRankingButton, setTrainCameraButton, setFreeCameraButton);
        } else {
            firstMovement = new TranslationMovement(mover, translationSpeed, TranslationStartStepType, TERRESTRIAL);
            //firstMovement.Update(FirstStation.transform.position);

            goOutMovement = normalMovement = new SequentialMovement()
                .AddMovement(new RotationMovement(mover, rotationSpeed, RotationDefaultStepType, TERRESTRIAL))
                .AddMovement(new TranslationMovement(mover, translationSpeed, TranslationDefaultStepType, TERRESTRIAL));

            networkPlayer.SetRoute(route);
        }

        return new MovementManager(FirstStation, LastStation, route, firstMovement, normalMovement, goOutMovement, passengers, timeCounter, points, gui, backToMenuButton, showRankingButton, isLocalTrain, playersPoints, network);
    }
コード例 #43
0
ファイル: GameProcess.cs プロジェクト: westernknight/24Taste
    void Start()
    {
        timer = GameObject.Find("TimeCounter").GetComponent<TimeCounter>();
        OperatorPanel = GameObject.Find("OperatorPanel");
        AnswerCardsPanel = GameObject.Find("AnswerCardsPanel");
        QuestionCardsPanel = GameObject.Find("QuestionCardsPanel");
        tweentyFourText = GameObject.Find("24");

        operator1 = GameObject.Find("operator1").GetComponent<Text>();
        operator2 = GameObject.Find("operator2").GetComponent<Text>();
        operator3 = GameObject.Find("operator3").GetComponent<Text>();


        List<string> l1 = new List<string>() { "+", "-", "x", "/" };
        List<string> l2 = new List<string>() { "+", "-", "x", "/" };
        List<string> l3 = new List<string>() { "+", "-", "x", "/" };
        List<string> l4 = new List<string>() { "+", "-", "x", "/" };
        for (int i = 0; i < l1.Count; i++)
        {
            string tmp = l1[i];
            for (int j = 0; j < l2.Count; j++)
            {
                tmp += l2[j];
                for (int k = 0; k < l3.Count; k++)
                {
                    tmp += l3[k];
                    for (int l = 0; l < l4.Count; l++)
                    {
                        tmp += l4[l];
                        //Debug.Log(tmp);
                        allMethod.Add(tmp);
                        tmp = tmp.Remove(tmp.Length - 1);
                    }

                    tmp = tmp.Remove(tmp.Length - 1);
                }
                tmp = tmp.Remove(tmp.Length - 1);
            }
        }

        for (int i = 0; i < allMethod.Count; i++)
        {
            allMethod[i] = allMethod[i].Remove(allMethod[i].Length - 1);
        }
        if (StartSceneSetting.instance)
        {
            if (StartSceneSetting.instance.level == 0)
            {
                StartSceneSetting.instance.PlayBGM(1);
            }
            else
            {
                StartSceneSetting.instance.PlayBGM(Random.Range(2, 6));
            }
            Vector3 vec = GameObject.Find("birds").transform.position;
            vec.y = StartSceneSetting.instance.audio.volume * Screen.height;
            GameObject.Find("birds").transform.position = vec;


        }

        GetQuestion();
    }
コード例 #44
0
ファイル: Main.cs プロジェクト: uaans/ocase
 private static void CreateCases(int number, List<Organization> organizations, List<User> users)
 {
     Random r = new Random();
     TimeCounter counter = new TimeCounter(string.Format("Create {0} cases", number));
     for (int i = 0; i < number; i++)
     {
         counter.Start();
         Case theCase = Case.GetOne(organizations[r.Next(0, organizations.Count - 1)], users[r.Next(0, users.Count - 1)]);
         theCase.Save();
         counter.Stop();
         Thread.Sleep(r.Next(10, 50));
     }
     counter.PrintTime();
 }
コード例 #45
0
ファイル: Timer.cs プロジェクト: rouchen/UnityDemo
    /// <summary>
    /// 註冊計時器.
    /// </summary>
    /// <param name="timeName">計時器名稱</param>
    /// <param name="timeSet">計時時間</param>
    /// <param name="isCountDown">是否倒數</param>
    /// <returns></returns>
    public bool RegisterCounter(string timeName, float timeSet, bool isCountDown)
    {
        if (timerCounterDic.ContainsKey(timeName))
        {
            return false;
        }

        TimeCounter counter = new TimeCounter();
        counter.timeSet = timeSet;
        counter.isCountDown = isCountDown;
        if (isCountDown)
        {
            counter.timeCount = timeSet;
        }
        counter.lastTimeInSecond = (int)counter.timeCount;

        timerCounterDic.Add(timeName, counter);
        return true;
    }
コード例 #46
0
ファイル: Main.cs プロジェクト: uaans/ocase
        public static void Main(string[] args)
        {
            try
            {
                // organizations and users
                List<Organization> organizations = CreateOrganization();
                List<User> users = CreateUsers();

                // creating cases
                CreateCases(100, organizations, users);
                CreateCases(1000, organizations, users);
                CreateCases(10000, organizations, users);
                CreateCases(500000, organizations, users);
                CreateCases(1000, organizations, users);

                // search cases
                CaseDataProvider provider = new CaseDataProvider();
                List<Case> cases;
                Random r = new Random();

                TimeCounter counter = new TimeCounter("C. Search by year and number");
                int found = 0;
                for (int i = 0; i < Configuration.SearchesNumber; i++)
                {
                    counter.Start();
                    cases = provider.GetByYearAndNumber(2010, r.Next(1, 100000));
                    counter.Stop();
                    found += cases.Count;
                }
                counter.PrintTime();
                counter.PrintLine(string.Format("Found {0} cases, avg. {1} per search.\n", found, found / Configuration.SearchesNumber));

                found = 0;
                counter = new TimeCounter("D. Search by case ID");
                for (int i = 0; i < Configuration.SearchesNumber; i++)
                {
                    counter.Start();
                    Case theCase = provider.GetById(r.Next(1, 100000));
                    counter.Stop();
                    if (theCase != null)
                    {
                        found++;
                    }
                }
                counter.PrintTime();
                counter.PrintLine(string.Format("Found {0} cases, avg. {1} per search.\n", found, found / Configuration.SearchesNumber));

                found = 0;
                counter = new TimeCounter("E. Search by case title");
                for (int i = 0; i < Configuration.SearchesNumber; i++)
                {
                    counter.Start();
                    cases = provider.GetByTitle(PhraseGenerator.GetRandomPhrase(1) + "%", 20);
                    counter.Stop();
                    found += cases.Count;
                }
                counter.PrintTime();
                counter.PrintLine(string.Format("Found {0} cases, avg. {1} per search.\n", found, found / Configuration.SearchesNumber));

                found = 0;
                counter = new TimeCounter("F. Search by custom field value");
                for (int i = 0; i < Configuration.SearchesNumber; i++)
                {
                    counter.Start();
                    cases = provider.GetByCustomFieldValue(PhraseGenerator.GetRandomPhrase(1) + "%", 20);
                    counter.Stop();
                    found += cases.Count;
                }
                counter.PrintTime();
                counter.PrintLine(string.Format("Found {0} cases, avg. {1} per search.\n", found, found / Configuration.SearchesNumber));
                /*
                if (cases.Count > 0)
                {
                    Console.WriteLine(cases[0]);
                }
                */
            }
            catch (Exception e)
            {
                Console.WriteLine("Error occured: {0}", e);
            }
            Console.WriteLine("Done, press a key...");
            Console.ReadKey();
        }
コード例 #47
0
ファイル: Main.cs プロジェクト: uaans/ocase
 private static List<User> CreateUsers()
 {
     List<User> users = new List<User>();
     if (Configuration.GenerateOrganization)
     {
         Console.WriteLine("Creating users...");
         TimeCounter counter = new TimeCounter("Creating 1000 users");
         for (int i = 0; i < 1000; i++)
         {
             counter.Start();
             User user = User.GetOne();
             user.Save();
             counter.Stop();
             users.Add(user);
         }
         counter.PrintTime();
     }
     else
     {
         users = new UserDataProvider().GetAll();
     }
     return users;
 }
コード例 #48
0
 public AutoPowerRegulator(PowerRegulator power_regulator)
 {
     _Counter = new TimeCounter();
     _PreviousTicks = _Counter.Ticks;
     _PowerRegulator = power_regulator;
 }
コード例 #49
0
ファイル: Main.cs プロジェクト: uaans/ocase
 private static List<Organization> CreateOrganization()
 {
     List<Organization> organizations = new List<Organization>();
     TimeCounter counter = new TimeCounter("Create 100 organization units");
     if (Configuration.GenerateOrganization)
     {
         Console.WriteLine("Creating organizations...");
         for (int i = 0; i < 100; i++)
         {
             counter.Start();
             Organization org = Organization.GetOne();
             org.Save();
             counter.Stop();
             organizations.Add(org);
         }
         counter.PrintTime();
     }
     else
     {
         organizations = new OrganizationDataProvider().GetAll();
     }
     return organizations;
 }