Inheritance: MonoBehaviour
Exemplo n.º 1
0
        /// <summary>
        /// 选座座位
        /// </summary>
        /// <param name="seatBtn"></param>
        /// <returns></returns>
        public bool SelectSeat(UsuallySeatUC_ViewModel seatBtn)
        {
            ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(seatBtn.ReadingRoomNo);

            clientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//给读者所在的阅览室赋值。

            //验证读者身份是否允许选择该阅览室。
            if (!Code.SelectSeatProven.ProvenReaderType(clientObject.EnterOutLogData.Student, roomInfo.Setting))
            {
                MessageWindow mesgWindow = new MessageWindow(MessageType.RoomNotReaderType);
                mesgWindow.ShowDialog();
                return(false);
            }
            //验证读者黑名单,选座次数。
            if (Code.SelectSeatProven.ProvenReaderState(clientObject.EnterOutLogData.Student, roomInfo, clientObject.RegulationRulesSet.BlacklistSet, clientObject.ClientSetting.DeviceSetting))
            {
                this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = "";
                return(false);
            }
            SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
            if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
            {
                clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
                clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = seatBtn.ReadingRoomName;
                MessageWindow mesgWindow = new MessageWindow(MessageType.SelectSeatConfirm);
                CountDown.Pause();
                mesgWindow.ShowDialog();
                CountDown.Start();
                if (mesgWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Successed)
                {
                    clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = seatBtn.ReadingRoomName;
                    clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = seatBtn.ReadingRoomNo;
                    clientObject.EnterOutLogData.EnterOutlog.SeatNo          = seatBtn.SeatNo;
                    clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
                    clientObject.EnterOutLogData.EnterOutlog.TerminalNum     = clientObject.ClientSetting.ClientNo;
                    clientObject.EnterOutLogData.FlowControl        = SeatManage.EnumType.ClientOperation.SelectSeat; //操作为选择座位
                    clientObject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}选择常坐座位,{1},{2}号座位", clientObject.ClientSetting.ClientNo, clientObject.EnterOutLogData.Student.AtReadingRoom.Name, seatBtn.ShortSeatNo);
                    return(true);
                }
                else
                {
                    T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                }
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)//没有成功加锁
            {
                MessageWindow mesgWindow = new MessageWindow(MessageType.SeatIsLocked);
                CountDown.Pause();
                mesgWindow.ShowDialog();
                CountDown.Start();
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.NotExists)
            {
                MessageWindow mesgWindow = new MessageWindow(MessageType.SeatNotExist);
                CountDown.Pause();
                mesgWindow.ShowDialog();
                CountDown.Start();
            }
            return(false);
        }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     gameManagerX = GameObject.Find("Game Manager").GetComponent <GameManagerX>();
     countDown    = GameObject.Find("Tme Text").GetComponent <CountDown>();
     button       = GetComponent <Button>();
     button.onClick.AddListener(SetDifficulty);
 }
Exemplo n.º 3
0
        private void SetGameItem()
        {
            _txtNumber.Text = string.Format("{0}/{1}", _cpt, _images.Count);
            _timer          = new CountDown(11000, 1000);
            _timer.Tick    += Timer_Tick;
            _timer.Finish  += _timer_Finish;
            _timer.Start();
            var names = DataEntryPoint.Instance.Images.GetOtherNames(_images[_cpt]);

            _image.SetImageURI(Android.Net.Uri.FromFile(new Java.IO.File(_images[_cpt].Path)));

            _currentItem = new GameItem();
            _currentItem.AddAnswer(_images[_cpt].Name, true);
            foreach (var item in names)
            {
                _currentItem.AddAnswer(item, false);
            }

            _currentItem.Shuffle();

            for (int i = 0; i < _currentItem.Answers.Count; i++)
            {
                _buttons[i].Text = _currentItem.Answers[i].Value;
            }
        }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     gameOverUI.SetActive(false);
     winUI.SetActive(false);
     CountDown countdown = GetComponent <CountDown> ();
     Code      code      = GetComponent <Code> ();
 }
Exemplo n.º 5
0
    void Awake()
    {
        // Time button
        cameraGrey             = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraGrey>();                         // shader
        stoppableObjectManager = GameObject.FindGameObjectWithTag("StoppableObjectManager").GetComponent <StoppableObjectManager>(); // manager
        timeGUI = Resources.FindObjectsOfTypeAll <TimeGUI>()[0] as TimeGUI;

        // Animation
        spriteRenderer = GetComponent <SpriteRenderer>(); // Sprite flip X
        rb             = GetComponent <Rigidbody2D>();    // physics
        animator       = GetComponent <Animator>();       // Animator

        // Item collection
        bag = GetComponent <Bag>();

        // Bonus room
        movableCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MovableCamera>();
        countDown     = Resources.FindObjectsOfTypeAll <CountDown>()[0] as CountDown;

        // Falling
        gravity       = Physics.gravity.y;              // fall force
        boxCollider2D = GetComponent <BoxCollider2D>(); // raycast width
        sceneHeight   = GameObject.FindGameObjectWithTag("OuterBorder").GetComponent <OuterBorder>().BorderHeight();

        // Sound play
        // soundManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundManager>();
        soundManager = GetComponent <SoundManager>();
    }
Exemplo n.º 6
0
    void Update()
    {
        boxColliderBoundMin = BoxCollider2D.bounds.min;
        CountDown.DecreaseTime(destroyCountDown);

        if (destroyCountDown.ReturnedToZero)
        {
            Destroy(gameObject);
        }

        if (!stop)
        {
            if (Vector3.Distance(new Vector2(transform.position.x, transform.position.y), new Vector2(startPosition.x, startPosition.y)) < distance * holdTime)
            {
                Animator.SetBool("Fly", true);
                transform.position = Vector3.MoveTowards(transform.position, transform.position + direction * (2 * holdTime), 4);
            }
            else
            {
                Stop();
            }

            Collider();
        }

        transform.position = Utils.SetPositionZ(transform, BoxCollider2D.bounds.min.y);
    }
Exemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     countDown         = GetComponent <CountDown>();
     playerRigidbody2D = GetComponent <Rigidbody2D>();
     animator          = GetComponent <Animator>();
     audioManager      = GameObject.Find("AudioManager").GetComponent <AudioManager>();
 }
Exemplo n.º 8
0
    void Start()
    {
        GameObject timer     = GameObject.Find("Timer");
        CountDown  countDown = timer.GetComponent <CountDown> ();

        coverWall.SetActive(false);
    }
Exemplo n.º 9
0
 public void IsStopped_ShouldReturnFalse_AfterDecreasedLessTimeThanFirstStarted()
 {
     var countDown = new CountDown();
     countDown.Start(5);
     countDown.Decrease(4);
     Assert.False(countDown.IsStopped);
 }
Exemplo n.º 10
0
        public override void Enter()
        {
            //Timer
            countDownNewItem = CountDown.Create();

            WaitNewItem();
        }
Exemplo n.º 11
0
 public void IsStopped_ShouldReturnFalse_AfterStarted()
 {
     var countDown = new CountDown();
     countDown.Start(5);
     Assert.IsFalse(countDown.IsStopped);
     
 }
Exemplo n.º 12
0
        public MainWindow()
        {
            InitializeComponent();
            var cd = new CountDown();

            DataContext = cd;
        }
Exemplo n.º 13
0
 private void ProgramIsDoneCountingDown()
 {
     if (this.CountDown.InvokeRequired)
     {
         CountDown.Invoke(new MethodInvoker(delegate { CountDown.Hide(); }));
     }
 }
Exemplo n.º 14
0
    //private SpelareKontroller Kontroll;


    // Use this for initialization
    void Start()
    {
        GenerateRandom();
        CountDown.SetActive(true);
        //Kontroll = GameObject.Find( "Player").GetComponent<SpelareKontroller>();
        //Kontroll.SlowDown = false;
    }
Exemplo n.º 15
0
        public void DebugTime(string _)
        {
            CountDown CD = new CountDown();

            Timer.App.Current.MainWindow.Close(); // zavre predchozi okno
            CD.Show();                            // zobrazi okno s odpocetem
        }
Exemplo n.º 16
0
        private async void SongGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            UserRetries++;
            if (UserRetries < MAX_RETRIES)
            {
                var selectedSong = (Song)e.ClickedItem;
                if (selectedSong.Selected)
                {
                    ResultTextBlock.Text       = "You Won !";
                    PlayAgainButton.Visibility = Visibility.Visible;
                    UserRetries = 0;
                    CountDown.Stop();
                }
                else
                {
                    const string TRY_AGAIN = "Try Again";
                    ResultTextBlock.Text = TRY_AGAIN;
                    await Task.Delay(2000);

                    if (ResultTextBlock.Text == TRY_AGAIN)
                    {
                        ResultTextBlock.Text = "";
                    }
                }
            }
            else
            {
                GameOver();
            }
        }
Exemplo n.º 17
0
        private void ValidateBeforeStartCountdown(Tuple <String, DateTime> data)
        {
            if (data.Item1 == "")
            {
                if (!Tommorow)
                {
                    Tommorow = true;
                }

                //parsing waktu
                var end = timeController.BuildDate($"{TimeHelper.GetTommorowDateWithUSFormat()} {waktuShalat.subuh}");

                LblNamaShalat.Text = "subuh";
                LblJam.Text        = waktuShalat.subuh;

                timeController.StartCountdown(end);

                CountDown.Start();
            }
            else
            {
                LblNamaShalat.Text = data.Item1;
                LblJam.Text        = data.Item2.ToString("HH:mm");

                DateTime EndTime = data.Item2;

                timeController.StartCountdown(EndTime);

                CountDown.Start();
            }
        }
Exemplo n.º 18
0
 private IEnumerator SavingPlayer()
 {
     savePlayerCountDown.StartToCount();
     while (true)
     {
         if (Input.GetKey(KeyCode.J))
         {
             CountDown.DecreaseTime(savePlayerCountDown);
             yield return(new WaitForSeconds(Time.deltaTime));
         }
         else
         {
             print("não salvou!");
             savePlayerCountDown.CoolDown = 0;
             break;
         }
         if (savePlayerCountDown.ReturnedToZero)
         {
             print("salvou!");
             model.IsDead      = false;
             model.CurrentLife = 3;
             DAL.ProjectVikingsContext.alivePlayers.Add(model.GameObject);
             GetComponents <BoxCollider2D>().Where(x => !x.isTrigger).ToList().ForEach(x => x.enabled = true);
             LifeBar.value = CalculateLife();
             if (model.IsTank)
             {
                 DAL.ProjectVikingsContext.alivePrefPlayers.Add(model.GameObject);
             }
             PlayerAnimator.SetBool("WasSafe", true);
             break;
         }
     }
     SetForceToStop(false);
 }
Exemplo n.º 19
0
    public virtual bool Interact(ref List <string> items)
    {
        if (used || stateThis != state.idle)
        {
            return(false);
        }
        if (itemsNeeded.Length == 0 && items.Count != 0)
        {
            return(false);
        }
        for (int i = 0; i < itemsNeeded.Length; i++)
        {
            if (!items.Contains(itemsNeeded[i]))
            {
                return(false);
            }
        }
        for (int i = 0; i < itemsNeeded.Length; i++)
        {
            items.Remove(itemsNeeded[i]);
        }
        count = new CountDown();
        count.StartTimer(timer);
        stateThis = state.cooking;
        timerText.SetActive(true);

        if (interactSound)
        {
            source.Play();
        }

        ChildStart();
        return(true);
    }
Exemplo n.º 20
0
    public Chapter1()
    {
        int i;

        // обращение к классу без указания namespace
        CountDown cd1 = new CountDown(10);
        do
        {
            i = cd1.Count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();

        // обращение по псевдониму
        MyCounter cd2 = new MyCounter(8);
        do
        {
            i = cd2.Count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();

        // исключение неоднозначности с помощью псевдонима namespace
        Ctr::CountDown3 cd3 = new Ctr::CountDown3(8);
        do
        {
            i = cd3.Count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();
    }
Exemplo n.º 21
0
    static void Main()
    {
        // now, CountDown can be used directly.
        CountDown cd1 = new CountDown(10);
        int       i;

        do
        {
            i = cd1.Count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();
        CountDown cd2 = new CountDown(20);

        do
        {
            i = cd2.Count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();
        cd2.Reset(4);
        do
        {
            i = cd2.Count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();
    }
Exemplo n.º 22
0
    protected override void Update()
    {
        base.Update();

        if (stateThis == state.cooking)
        {
            if (count.timerDone())
            {
                stateThis = state.cooked;
                count     = new CountDown();
                countBurnt.StartTimer(timerBurnt);
                timerText.GetComponent <Text>().color = Color.red;
            }
        }
        else if (stateThis == state.cooked)
        {
            timerText.GetComponent <Text>().text = System.String.Format("{0:0.00}", timerBurnt - countBurnt.GetFractionDone() * timerBurnt) + 's';
            if (countBurnt.timerDone())
            {
                stateThis = state.burnt;
            }
        }
        else if (stateThis == state.burnt)
        {
            timerText.GetComponent <Text>().text = "BURNT!!";
            FindObjectOfType <TimerGame>().GameLost();
        }
    }
Exemplo n.º 23
0
    public void AddCountDown(int totalTime, params TimeDelegate[] funcs)
    {
        CountDown cd = new CountDown(totalTime, funcs);

        cd.listNode = this.cdList.AddLast(cd);
        frameTick  += cd.Calculate;
    }
Exemplo n.º 24
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 25
0
 public ExplosionPoint(int p_range, int delay)
 {
     this.range = p_range;
     this.explosionTimer = new CountDown(delay, true);
     base.type = ObjectType.ExplosionGenerator;
     this.explosionTexture = new GameTexture("explosion.bmp", new Size(0x10, 0x10), TextureDisposePolicy.DisposeOnSceneChange);
 }
    // Start is called before the first frame update
    void Start()
    {
        CountDown countdown = gameObject.AddComponent(typeof(CountDown)) as CountDown;

        this.timer = countdown;
        this.transform.localScale = new Vector3(0, 0, 0);
    }
Exemplo n.º 27
0
        private async void SetCountDown()
        {
            await Task.Delay(330);

            countDownForFiveSeconds = new CountDown(5000, 50, this, true);
            countDownForFiveSeconds.Start();
        }
Exemplo n.º 28
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         Player    player = other.GetComponent <Player>();
         OldGuy    oldMan = GameObject.FindObjectOfType <OldGuy>();
         CountDown clock  = GameObject.FindObjectOfType <CountDown>();
         if (player != null)
         {
             if (_powerUpID == 0)
             {
                 player.SpeedUpOn();
             }
             else if (_powerUpID == 1)
             {
                 oldMan.ShieldOn();
             }
             else if (_powerUpID == 2)
             {
                 clock.PuausePower();
             }
         }
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 29
0
 // Start is called before the first frame update
 void Start()
 {
     rig = this.GetComponent <Rigidbody2D>();
     rig.AddForce(new Vector2(0, -2f));
     countDown   = GameObject.Find("GameManager").GetComponent <CountDown>();
     buttonAudio = GameObject.Find("GameManager").GetComponent <ButtonAudio>();
 }
Exemplo n.º 30
0
        /// <summary>
        /// 键盘选座
        /// </summary>
        /// <returns></returns>
        public bool KeyboardSelectSeat()
        {
            KeyboardWindow keyboardWindow = new KeyboardWindow();

            CountDown.Pause();
            keyboardWindow.ShowDialog();
            CountDown.Start();
            if (!string.IsNullOrEmpty(keyboardWindow.viewModel.SeatNo))
            {
                clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = keyboardWindow.viewModel.SeatNo;
                clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = _ReadingRoomName;
                clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = _ReadingRoomNo;
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SelectSeatConfirm);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
                if (popWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Successed)
                {
                    clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = _ReadingRoomName;
                    clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = _ReadingRoomNo;
                    clientObject.EnterOutLogData.EnterOutlog.SeatNo          = keyboardWindow.viewModel.LongSeatNo;
                    clientObject.EnterOutLogData.EnterOutlog.TerminalNum     = clientObject.ClientSetting.ClientNo;
                    clientObject.EnterOutLogData.FlowControl        = SeatManage.EnumType.ClientOperation.SelectSeat; //操作为选择座位
                    clientObject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}输入座位号选择,{1},{2}号座位", clientObject.ClientSetting.ClientNo, clientObject.EnterOutLogData.Student.AtReadingRoom.Name, clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo);
                    return(true);
                }
                else
                {
                    T_SM_Seat.UnLockSeat(keyboardWindow.viewModel.LongSeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                }
            }
            return(false);
        }
Exemplo n.º 31
0
    void Awake()
    {
        ui   = GameObject.Find("UICanvas/Canvas").GetComponent <Canvas>();
        game = GameObject.Find("Game").GetComponent <IMiniGame>();

        countDown = ui.transform.Find("CountDown").gameObject.GetComponent <CountDown>();
    }
Exemplo n.º 32
0
    void Start()
    {
        gos         = GameObject.Find("CoinManager");
        coinManager = gos.GetComponent <CoinManager> ();
        countdown   = gocd.GetComponent <CountDown> ();

        if (coinManager.chriterion)
        {
            lsX = daAdBass.transform.localScale.x * coinManager.chriterionScale;
            lsY = daAdBass.transform.localScale.y * coinManager.chriterionScale;
            lsZ = daAdBass.transform.localScale.z;
            daAdBass.transform.localScale = new Vector3(lsX, lsY, lsZ);

            lsX = daSwappo.transform.localScale.x * coinManager.chriterionScale;
            lsY = daSwappo.transform.localScale.y * coinManager.chriterionScale;
            lsZ = daSwappo.transform.localScale.z;
            daSwappo.transform.localScale = new Vector3(lsX, lsY, lsZ);

            lsX = daTimeyWimey.transform.localScale.x * coinManager.chriterionScale;
            lsY = daTimeyWimey.transform.localScale.y * coinManager.chriterionScale;
            lsZ = daTimeyWimey.transform.localScale.z;
            daTimeyWimey.transform.localScale = new Vector3(lsX, lsY, lsZ);


            for (int x = 0; x < arrDaBadAss.Length; x++)
            {
                GameObject dba = arrDaBadAss [x];
                lsX = dba.transform.localScale.x * coinManager.chriterionScale;
                lsY = dba.transform.localScale.y * coinManager.chriterionScale;
                lsZ = dba.transform.localScale.z;
                dba.transform.localScale = new Vector3(lsX, lsY, lsZ);
            }
        }
        //GetBadAssCoin ();
    }
Exemplo n.º 33
0
    // Use this for initialization
    void Start()
    {
        countDown = GameObject.Find("GameManager").GetComponent <CountDown> ();
        GameManager gameManager   = GetComponent <GameManager> ();
        Code        codeScript    = GetComponent <Code> ();
        AudioSource overheatSound = GetComponent <AudioSource>();

        overheatEffect.SetActive(false);

        audioPlaying = false;

        alreadyRun = false;

        overheat    = false;
        overheating = false;
        y           = 0.39f;
        z           = -2.523f;
        overheatPos = new Vector3(-3.32f, y, z);

        startPos   = new Vector3(-3.8f, y, z);
        currentPos = startPos;

        maxPos = new Vector3(-2.445f, y, z);
        minPos = new Vector3(-3.87f, y, z);

        tempPointer        = GameObject.Find("Temperature Pointer").GetComponent <Transform> ();
        transform.position = currentPos;

        incrementSpeed = 0.02f;
        decrementSpeed = 0.0002f;

        cool = false;
    }
    public static void Main()
    {
        // Теперь класс CountDown можно использовать
        // без указания имени пространства имен.
        CountDown cd1 = new CountDown(10);
        int       i;

        do
        {
            i = cd1.count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();
        CountDown cd2 = new CountDown(20);

        do
        {
            i = cd2.count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();
        cd2.reset(4);
        do
        {
            i = cd2.count();
            Console.Write(i + " ");
        } while (i > 0);
        Console.WriteLine();
    }
Exemplo n.º 35
0
 void Start()
 {
     b = GameObject.Find ("ArmStrokes").GetComponent<ArmStrokes>();
     countDown = GameObject.Find ("Countdown").GetComponent<CountDown>();
     p = GameObject.Find ("Player").GetComponent<PlayerControl>();
     SC = GameObject.Find ("SwimmingController").GetComponent<SwimmingController>();
     Sounds = GameObject.Find("Sounds").GetComponent<SwimmingSounds>();
 }
Exemplo n.º 36
0
 public FallingBlock(string p_mapname, FallingBlockTrigger p_trigger, int p_delay)
 {
     this.mapName = p_mapname;
     this.trigger = p_trigger;
     this.textureCell = (this.trigger == FallingBlockTrigger.PlayerNear) ? new Point(4, 3) : new Point(5, 2);
     this.delay = new CountDown(p_delay, false);
     base.texture = new GameTexture("cursor.bmp", new Size(0x10, 0x10), TextureDisposePolicy.NeverDispose);
     base.type = ObjectType.FallingBlock;
 }
Exemplo n.º 37
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Splash);

			MainScreen actMain = new MainScreen ();

			CountDown tik= new CountDown (5000,5000,this,actMain);
			tik.Start ();
			StartAnimation();

		}
Exemplo n.º 38
0
 public Animation(Point animCell, Size size)
 {
     this.drawPoint = new PointF(0f, 0f);
     this.frameTimer = new CountDown(0, true);
     this.rotation = Direction.Up;
     this.repeat = true;
     this.direction = Direction.Right;
     this.tileRow = animCell.Y;
     this.type = AnimHitType.None;
     this.textureSize = size;
     this.hCenter = size.Width / 2;
     this.frameTimer.Max = 1;
     this.sequence = new int[] { animCell.X };
     this.secondardyCollisionRectangle = new RectangleF(0f, 0f, 2f, 2f);
 }
Exemplo n.º 39
0
        public Test Perform()
        {
            // create timer

            del callBack = this.End;

            this.timerContainer = new CountDown(0, 0, 5, callBack);
            this.timerContainer.AutoSize = true;
            this.timerContainer.BackColor = Color.White;
            this.timerContainer.Timer.Start();

            this.Controls.Add(this.timerContainer);

            return this;
        }
Exemplo n.º 40
0
 public Animation(AnimHitType p_type, Size p_textureSize, int[] p_sequence, int p_speed, int p_hCenter, bool p_flip)
 {
     this.drawPoint = new PointF(0f, 0f);
     this.frameTimer = new CountDown(0, true);
     this.rotation = Direction.Up;
     this.repeat = true;
     this.direction = Direction.Right;
     this.flip = p_flip;
     this.type = p_type;
     this.textureSize = p_textureSize;
     this.hCenter = p_hCenter;
     this.frameTimer.Max = p_speed;
     this.sequence = new int[p_sequence.Length];
     p_sequence.CopyTo(this.sequence, 0);
     this.secondardyCollisionRectangle = new RectangleF(0f, 0f, 2f, 2f);
 }
Exemplo n.º 41
0
 public void IsStopped_ShouldReturnTrue_AfterDecreasedMoreTimeThanFirstStarted()
 {
     {
         var countDown = new CountDown();
         countDown.Start(5);
         countDown.Decrease(5);
         Assert.IsTrue(countDown.IsStopped);
     }
     {
         var countDown = new CountDown();
         countDown.Start(5);
         countDown.Decrease(2);
         countDown.Decrease(2);
         countDown.Decrease(2);
         Assert.IsTrue(countDown.IsStopped);
     }
 }
Exemplo n.º 42
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        { // if left button pressed...
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                var selecatbeObject = hit.collider.gameObject.GetComponent<Selectable>();

                if (hit.collider.gameObject.layer != Layers.SelectField)
                    return;

                if (selecatbeObject != null)
                {
                    selecatbeObject.Select();
                    _CountDown = CountDown.CreateCountDown(0.5f);
                    _CountDown.Start();
                    _CountDown.TimeElapsed += (sender, args) =>
                    {
                        if(selecatbeObject != null)
                            selecatbeObject.HighLight();
                        else
                        Selector.Instance.Unselect();

                        _CountDown = null;
                    };
                }
                else
                    Selector.Instance.Unselect();
            }
            else
                Selector.Instance.Unselect();
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (_CountDown != null)
                _CountDown.Stop();
            _CountDown = null;
        }
    }
Exemplo n.º 43
0
 public GameMap(string mapFile, int startDoor)
 {
     this.skyColor = Color.Black;
     this.flashColor = Color.Yellow;
     this.fadeChange = 0.1f;
     this.flashDelay = new CountDown(2, true);
     this.editorPoint = new Point(0, 0);
     this.dragOffset = new Point(0, 0);
     this.curTexture = new Point(1, 0);
     this.selectionStart = new Point(0, 0);
     this.screenPos = new PointF(0f, 0f);
     this.drawObjects = true;
     this.liquidSurface = SurfaceType.WaterSurface;
     this.nextMap = "";
     this.gameOverTimer = -1;
     if (this.SetupScene(mapFile))
     {
         foreach (Door door in this.doors)
         {
             if (door.ID == startDoor)
             {
                 GameEngine.Game.GetPlayerStats().PlayerEntry = new PointF(door.Location.X + 16f, door.Location.Y + 64f);
                 if (door.TypeOfDoor == DoorType.ExitOnly)
                 {
                     GameEngine.Framework.PlaySound(SoundEffects.OpenDoor);
                     this.state = SceneState.DoorOut;
                     this.currentDoor = door;
                 }
                 if ((door.TypeOfDoor == DoorType.PlayerStart) && (door.DestinationDoor > 0))
                 {
                     ((PlayerBehavior) this.player.ObjectBehavior).Boost();
                 }
             }
         }
         this.SetScreenPos();
         this.tileMap.DetermineVisibleTiles(this.screenPos);
     }
 }
Exemplo n.º 44
0
	// Use this for initialization
	void Start () {
		gameController = GameObject.FindObjectOfType<GameController>();

		countDown = GetComponentInChildren<CountDown>();
	}
Exemplo n.º 45
0
    void Start()
    {
        player = GameObject.Find ("Player");
        p = player.GetComponent<PlayerControl> ();
        Timer = GetComponent<Timer> ();
        animations = player.GetComponent<Animations> ();
        cam = GameObject.Find ("Main Camera").GetComponent<CameraController> ();
        countDown = GameObject.Find ("Countdown").GetComponent<CountDown> ();
        SC = GameObject.Find ("SwimmingController").GetComponent<SwimmingController>();
        Sounds = GameObject.Find ("Sounds").GetComponent<SwimmingSounds>();

        armStrokeOK = true;
        leftStrokeOK = true;
        rightStrokeOK = true;
        square1.enabled = false;
        square2.enabled = false;
    }
Exemplo n.º 46
0
        public GameMap(string mapFile, Direction enterDir, float position)
        {
            this.skyColor = Color.Black;
            this.flashColor = Color.Yellow;
            this.fadeChange = 0.1f;
            this.flashDelay = new CountDown(2, true);
            this.editorPoint = new Point(0, 0);
            this.dragOffset = new Point(0, 0);
            this.curTexture = new Point(1, 0);
            this.selectionStart = new Point(0, 0);
            this.screenPos = new PointF(0f, 0f);
            this.drawObjects = true;
            this.liquidSurface = SurfaceType.WaterSurface;
            this.nextMap = "";
            this.gameOverTimer = -1;
            PointF playerEntry = GameEngine.Game.GetPlayerStats().PlayerEntry;
            int num = 0x20;
            this.SetupScene(mapFile);
            switch (enterDir)
            {
                case Direction.Left:
                    playerEntry.Y = position;
                    playerEntry.X = num;
                    break;

                case Direction.Right:
                    playerEntry.Y = position;
                    playerEntry.X = (this.tileMap.MapSize.Width * TileSize.Width) - num;
                    break;

                case Direction.Up:
                    playerEntry.X = position;
                    playerEntry.Y = num;
                    break;

                case Direction.Down:
                    playerEntry.X = position;
                    playerEntry.Y = (this.tileMap.MapSize.Height * TileSize.Height) - num;
                    break;

                default:
                    playerEntry.X = -1f;
                    playerEntry.Y = -1f;
                    break;
            }
            this.SetScreenPos();
            this.tileMap.DetermineVisibleTiles(this.screenPos);
            GameEngine.Game.GetPlayerStats().PlayerEntry = new PointF(playerEntry.X, playerEntry.Y);
        }
Exemplo n.º 47
0
        /// <summary>
        /// メインゲームシーン
        /// </summary>
        /// <param name="content"></param>
        /// <param name="graphicsDevice"></param>
        /// <param name="input"></param>
        public GameIn(ContentManager content, GraphicsDevice graphicsDevice, GameTime gameTime, StageSelect.SelectStage selectStage, StageSelect.SelectEnemy selectEnemy)
        {
            this.content = content;
            this.graphicsDevice = graphicsDevice;

            this.selectStage = selectStage;

            // 乱数の初期化
            rand = new Random();

            // 迷路初期化。難易度によって大きさを変える
            maze = new Maze(content, selectStage);

            Point playerPosition;
            Point goalPosition;

            while (true)
            {
                playerPosition = maze.RandomPoint();
                goalPosition = maze.RandomPoint();

                // 迷路の斜辺の長さを求める。三平方の定理 c^2 = sqrt(a^2 + b^2)
                double hypotenuse = Math.Sqrt(maze.Width * maze.Width + maze.Height * maze.Height);

                // 0.5斜辺 < 距離 < 0.6斜辺ならOK
                double distance = Math.Sqrt((playerPosition.X - goalPosition.X) * (playerPosition.X - goalPosition.X) + (playerPosition.Y - goalPosition.Y) * (playerPosition.Y - goalPosition.Y));
                if (hypotenuse * 0.5 < distance && distance < hypotenuse * 0.6)
                {
                    break;
                }
            }

            //プレイヤー初期化
            player = new Player(content, playerPosition, Collidable.Collidable.Orientation.East, maze);

            //ゴール初期化
            goalobj = new GoalObject(content, goalPosition, Collidable.Collidable.Orientation.East, maze);

            // Enemyマネージャ初期化
            enemyManager = new EnemyManager(content, selectEnemy, selectStage, maze, player);

            //背景モデルの宣言
            backmodel = new BackGround(content);

            //カメラの初期設定
            camera = new Camera(player);

            // ミニマップの初期化
            miniMap = new MiniMap(content, graphicsDevice);

            // スコアの初期化
            score = new Score(content, graphicsDevice, gameTime, selectStage);

            //フェードアウト処理
            fadeout = new FadeOut(content, graphicsDevice, FadeOut.SceneType.InGame);

            // カウントダウン
            countdown = new CountDown(content, graphicsDevice, gameTime);

            // BGMの再生
            cueBGM = SoundManager.Instance.SoundBank.GetCue("game");
        }
Exemplo n.º 48
0
    void Start()
    {
        for (int i = 0; i < InitialNeutralCells; i++)
        {
            SpawnNeutral();
        }

        playerScript = GameObject.Find("Player").GetComponent<PlayerScript>();

        ui = GameObject.Find("PlayerUI").GetComponent<PlayerUI>();
        countdownUI = GameObject.Find("countdownCanvas").GetComponent<CountDown>();

        cameraScript = GameObject.Find("Main Camera").GetComponent<CameraFollow>();

        SpawnUrgency = 5.0f;

        syringe = GameObject.Find("syringe");

        ui.gameObject.SetActive(false);

        preGameCounter = 4.0f;

        difficulty = DifficultySelection.EASY;

        if (GameObject.Find("PersistentObject(Clone)"))
        {
            difficulty = GameObject.Find("PersistentObject(Clone)").GetComponent<PersistentData>().difficulty;
            Destroy(GameObject.Find("PersistentObject(Clone)"));
        }

        if (difficulty == DifficultySelection.EASY)
        {
            levelTimer = 240.0f;
        }
        else if (difficulty == DifficultySelection.MEDIUM)
        {
            levelTimer = 180.0f;
        }
        else
        {
            levelTimer = 120.0f;
        }

        audioSource = transform.GetComponent<AudioSource>();

        audioSource.clip = regularBGM;
        audioSource.Play();
    }
Exemplo n.º 49
0
 public void IsStopped_ShouldReturnTrue_WhenNew()
 {
     var countDown = new CountDown();
     Assert.IsTrue(countDown.IsStopped);
 }
Exemplo n.º 50
0
        public override bool DoAction(GameObject o)
        {
            switch (this.state)
            {
                case 0:
                    o.CurrentAnimation = AnimType.Stopped2;
                    o.XSpeed.SetSpeed((float) 0f);
                    o.YSpeed.SetSpeed((float) 4f);
                    if (o.Y >= this.lowPos)
                    {
                        o.Y = this.lowPos;
                        this.state = 1;
                        o.YSpeed.SetSpeed((float) 0f);
                        new FacePlayer().DoAction(o);
                        new Move((float) this.hSpeed, 0f).DoAction(o);
                        this.timer = new CountDown(Utility.RandomInt(180, 400), false);
                    }
                    goto Label_0311;

                case 1:
                    o.CurrentAnimation = AnimType.Stopped2;
                    if ((o.X >= 16f) || (o.XSpeed.TargetSpeed >= 0f))
                    {
                        if ((o.X > (GameEngine.ScreenWidth - 0x10)) && (o.XSpeed.TargetSpeed > 0f))
                        {
                            o.CurrentDirection = Direction.Left;
                            o.XSpeed.SetSpeed((float) -this.hSpeed);
                        }
                        break;
                    }
                    o.CurrentDirection = Direction.Right;
                    o.XSpeed.SetSpeed((float) this.hSpeed);
                    break;

                case 2:
                    o.CurrentAnimation = AnimType.Stopped2;
                    o.XSpeed.SetSpeed((float) 0f);
                    o.YSpeed.SetSpeed((float) -2f);
                    if (o.Y <= this.hiPos)
                    {
                        o.Y = this.hiPos;
                        this.state = 3;
                        o.YSpeed.SetSpeed((float) 0f);
                        this.timer = new CountDown(60, false);
                    }
                    goto Label_0311;

                case 3:
                    o.Y = this.hiPos;
                    o.CurrentAnimation = AnimType.Stopped;
                    o.XSpeed.SetSpeed((float) 0f);
                    o.YSpeed.SetSpeed((float) 0f);
                    if (this.timer.Update())
                    {
                        this.shoot.Reset();
                        this.state = 4;
                        this.shotGroups = 8;
                        this.timer = new CountDown(30, false);
                    }
                    goto Label_0311;

                case 4:
                    o.Y = this.hiPos;
                    new Move(0.2f, 0f).DoAction(o);
                    o.CurrentAnimation = AnimType.Attacking;
                    if (this.shotTimer.Update() && this.shoot.DoAction(o))
                    {
                        this.shoot.Reset();
                        this.shotTimer.Timer = this.shotTimer.Max;
                    }
                    if (this.timer.Update())
                    {
                        this.shotGroups--;
                        if (this.shotGroups == 0)
                        {
                            this.state = 0;
                        }
                        else
                        {
                            this.shotTimer.Max = Utility.RandomInt(3, 6);
                            this.timer.Timer = this.timer.Max;
                        }
                    }
                    goto Label_0311;

                default:
                    goto Label_0311;
            }
            if (this.timer.Update())
            {
                new FacePlayer().DoAction(o);
                this.state = 2;
            }
            Label_0311:
            return false;
        }
Exemplo n.º 51
0
 public override void Reset()
 {
     this.state = 0;
     this.timer = new CountDown(10, false);
 }