Пример #1
0
        private void StartGame()
        {
            FreezeTime.Start();
            GameTime.Start();
            Start.Start();
            lbl_ScoreCounter.Text = "0";
            lbl_FreezeTime.Text   = "5";
            lbl_moves.Text        = "0";
            lbl_PlayerName.Text   = OPlayer.Name;
            lbl_size.Text         = SIZE.ToString();
            Board = new Board[SIZE, SIZE];

            for (int i = 0; i < SIZE; i++)
            {
                for (int j = 0; j < SIZE; j++)
                {
                    PictureBox Pictureboxs = new PictureBox();
                    Pictureboxs.Name                  = "pic_" + i.ToString() + "-" + j.ToString();
                    Pictureboxs.Location              = new Point(i * 105, j * 155);
                    Pictureboxs.Size                  = new Size(100, 150);
                    Pictureboxs.Parent                = this;
                    Pictureboxs.Tag                   = SetRandomImages();
                    Pictureboxs.BackgroundImage       = Image.FromFile(Pictureboxs.Tag.ToString());
                    Pictureboxs.BackgroundImageLayout = ImageLayout.Stretch;
                    Pictureboxs.Enabled               = false;
                    Pictureboxs.Click                += new EventHandler(btnClick);

                    Board[i, j]            = new Board();
                    Board[i, j].PictureBox = Pictureboxs;
                }
            }
        }
Пример #2
0
 void ResetTimeAndSetLaunchToFalse()
 {
     FreezeTime.StartTimeAgain();
     // ZoomOut();
     launching = false;
     currentSoulBehaviour.launching = false;
     NotLaunchingSoul();
 }
Пример #3
0
        private void FreezeTime_Tick(object sender, EventArgs e)
        {
            int timer = Convert.ToInt32(lbl_FreezeTime.Text);

            timer = timer - 1;
            lbl_FreezeTime.Text = Convert.ToString(timer);
            if (timer == 0)
            {
                FreezeTime.Stop();
                lbl_FreezeTime.Visible = false;
            }
        }
Пример #4
0
 void Awake()
 {
     if (i != null)
     {
         Debug.LogError("More than one FreezeTime Script in play.");
         return;
     }
     else
     {
         i = this;
     }
 }
        private static IEnumerator LoadMusic(bool force = false)
        {
            if (Config.IncludeOST)
            {
                LoadOST();
            }
            LoadCustomMusic();

            var failed = failedPaths.Count();

            yield return(new WaitWhile(() => WaitScreen.main == null));

            if (OSTPreload == null && OST.Any(x => x.Value == null))
            {
                OSTPreload = CoroutineHost.StartCoroutine(PreloadOST());
            }
            if (CustomMusicPreload == null && CustomMusic.Any(x => x.Value == null))
            {
                CustomMusicPreload = CoroutineHost.StartCoroutine(PreloadCustomMusic());
            }

            if ((OSTPreload != null || CustomMusicPreload != null) && force)
            {
                FreezeTime.Begin("CustomTunesPreload");
                WaitScreen.ShowImmediately();
            }

            yield return(OSTPreload);

            yield return(CustomMusicPreload);

            GeneratePlaylist();

            yield return(new WaitWhile(() => WaitScreen.main.isShown));

            FreezeTime.End("CustomTunesPreload");

            if (failedPaths.Count() > failed)
            {
                ErrorMessage.AddError("Some tracks failed to load, see error log for details.");
            }
        }
Пример #6
0
 public void Show(string reason)
 {
     FreezeTime.Begin("NitroxDisconnected");
     StartCoroutine(Show_Impl(reason));
 }
Пример #7
0
    public IEnumerator PrimeSlingshot(GameObject whichSoul)
    {
        currentSoulBehaviour = whichSoul.GetComponent <SoulBehavior>();
        PrimingSoul();
        if (!zoomed)
        {
            //  ZoomOnPlayer();
        }
        //Debug.Log("Priming!");
        priming = true;
        currentSoulBehaviour.beingPrimed = true;
        mouseStartPosition = Input.mousePosition;
        float   distance  = 0;
        Vector2 direction = new Vector2(0, 0);

        slingshotLineRenderer         = whichSoul.GetComponentInChildren <LineRenderer>();
        slingshotLineRenderer.enabled = true;
        FreezeTime.SlowdownTime(0.10f);
        while (true)
        {
            if (Input.GetMouseButtonUp(1))
            {
                break;
            }
            if (Input.GetMouseButtonDown(0))
            {
                //right click to cancel
                stillHeld = true;
                slingshotLineRenderer.enabled = false;
                yield break;
            }
            slingshotLineRenderer.SetPosition(0, whichSoul.transform.position);
            slingshotLineRenderer.SetPosition(1, Camera.main.ScreenToWorldPoint(new Vector2(Input.mousePosition.x, Input.mousePosition.y)));
            yield return(null);
        }
        slingshotLineRenderer.enabled = false;

        Vector2 mousePos           = Input.mousePosition;
        Vector2 mousePositionWorld = Camera.main.ScreenToWorldPoint(new Vector2(mousePos.x, mousePos.y));

        Rigidbody2D soulRigidbody = whichSoul.GetComponent <Rigidbody2D>();

        distance  = Vector2.Distance(whichSoul.transform.position, mousePositionWorld);
        direction = (Vector2)((Vector2)whichSoul.transform.position - mousePositionWorld);


        float velocity = distance * Mathf.Sqrt(elasticity / soulRigidbody.mass);

        velocity *= (10); //multiply to cancel out low timescale
        soulRigidbody.isKinematic = false;
        soulRigidbody.velocity    = (direction.normalized * velocity);

        //Debug.Log(pReference.rb.velocity);
        priming = false;
        currentSoulBehaviour.beingPrimed = false;
        currentSoulBehaviour.launching   = true;
        DonePrimingSoul();
        launching = true;
        LaunchingSoul(whichSoul);
        StartCoroutine(CountdownFromLaunch());
        //   StartCoroutine(PlotPath());
    }
Пример #8
0
 public void Show()
 {
     FreezeTime.Begin("NitroxDisconnected");
     StartCoroutine(Show_Impl());
 }