IEnumerator AwaitForBonuse() { yield return(new WaitForSeconds((3 + 3 * Frequency))); // await (for create a bonuse) MainStart CurrentMS = GetComponent <ControlOfPl> ().SetOfLines[Random.Range(0, GetComponent <ControlOfPl> ().SetOfLines.Length)]; // Get a line when it will if (CurrentMS.Active) { if (!stopCreate && CurrentMS.GeneratedBalls.Count > 5) // if balls in line > 5 { CurrentBall = CurrentMS.GeneratedBalls [Random.Range(0, CurrentMS.GeneratedBalls.Count)].gameObject; RandomBonuse = Random.Range(0, 8); // Сгенерируем бонусы самостоятельно // RandomBonuse = 6; ObjectBonuse.sprite = SpritesOfBonuse [RandomBonuse]; ObjectBonuse.color = CurrentBall.GetComponent <SpriteRenderer> ().color; ObjectBonuse.sortingOrder = CurrentBall.GetComponent <SpriteRenderer> ().sortingOrder + 1; ObjectBonuse.gameObject.SetActive(true); ObjectBonuse.color = new Color(ObjectBonuse.color.r, ObjectBonuse.color.g, ObjectBonuse.color.b, 0); ActiveBonuse = true; } } else { ActiveBonuse = false; StartCoroutine("AwaitForBonuse"); } yield return(new WaitForSeconds((5 + Frequency))); ActiveBonuse = false; StartCoroutine("AwaitForBonuse"); }
public static MainStart getInstance() { if( Instance == null ) { Instance = new MainStart(); Debug.Log( "Game Instance created"); } return Instance; }
public void calculate(int x) { Debug.Log("PIZDA"); MainStart main = main0.GetComponent <MainStart>(); float minW = (30 * main.NumberOfBalls) + (40 * main.NumberOfBalls) + (12 * main.NumberOfBalls); float k2 = main.BaseSpeed + 0.72f; float k3 = main.BaseSpeed + 0.556f; float mf2 = (minW / k2); float mf3 = minW / k3; int stars2 = Mathf.CeilToInt(mf2); int stars3 = Mathf.FloorToInt(mf3); ScoreFor2Stars = x * stars2; ScoreFor3Stars = x * stars3; }
static void Main(string[] args) { var asd = APIProvider.AuthAPI.GetToken("4MfCH65CufRztreOkao2kgCWH1cEe59z", "OZUegy8FE6vwT4EpeZxxOcp1RHswF2CB").Result; MainStart.Start(args, () => { if (CommandProvider.UpgraderVisible) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } else { Application.Run(); } }); Console.WriteLine("-unupgradable"); }
public void WinProcess(MainStart GetScript) // WIN { GetScript.StopCoroutine("GenerateLine"); GetScript.StopCoroutine("OnlineSend"); GetScript.Active = false; int CountOfMS = 0; int SaveLinesActive = 0; while (CountOfMS < SetOfLines.Length) { if (!SetOfLines [CountOfMS].Active) { SaveLinesActive++; } CountOfMS++; } if (SaveLinesActive == SetOfLines.Length) { GetComponent <ControlOfPl> ().CanThrow = new Vector3(1, 1, 1); GameObject.Find("Canvas").GetComponent <InGame> ().ToWin(GetComponent <ControlOfPl>().Score); } }
static void Main(string[] args) { MainStart.Start(); }
void OnTriggerEnter(Collider other) { if (!once && GameObject.Find("Main Camera").GetComponent <ControlOfPl> ().Player_off == 0) // if all right { if (other.gameObject.GetComponent <BallControl> () != null && gameObject.name == "throw ball" && !This_destroyBall && !This_fireBall && !This_DestroyColor && other.gameObject.name != "ball under off") // if it`s simple ball { if (other.GetComponent <BallControl> ().c < other.GetComponent <BallControl> ().ccObject.SetOfPoints.Count - 7) // if it`s not near finish { BallControl otherToScript = other.gameObject.GetComponent <BallControl> (); // get component from other ball mainStart = otherToScript.msScript; GetComponent <BallControl> ().ccObject = otherToScript.ccObject; GetComponent <BallControl> ().msScript = otherToScript.msScript; //тут идет проигрывание звука шарик ударяется if (GameObject.Find("Sound Center").GetComponent <SoundCenter> ().Ball_collision_with_line != null) { GameObject.Find("SC 1").GetComponent <AudioSource> ().PlayOneShot(GameObject.Find("Sound Center").GetComponent <SoundCenter> ().Ball_collision_with_line); } timeBall = mainStart.TimeBall; once = true; Vector3 GetFirst = otherToScript.ccObject.GetNewVector(otherToScript, 0.001f, otherToScript.t - 1, otherToScript.c, true); Vector3 GetSecond = otherToScript.ccObject.GetNewVector(otherToScript, 0.001f, otherToScript.t + 1, otherToScript.c, true); // calculate a two distances, need for get info about future position of ball float dist1 = Mathf.Sqrt((transform.position.x - GetFirst.x) * (transform.position.x - GetFirst.x) + (transform.position.y - GetFirst.y) * (transform.position.y - GetFirst.y) + (transform.position.z - GetFirst.z) * (transform.position.z - GetFirst.z)); float dist2 = Mathf.Sqrt((transform.position.x - GetSecond.x) * (transform.position.x - GetSecond.x) + (transform.position.y - GetSecond.y) * (transform.position.y - GetSecond.y) + (transform.position.z - GetSecond.z) * (transform.position.z - GetSecond.z)); float interval = mainStart.interval; if (dist1 > dist2) { // After this ball mode = mainStart.GeneratedBalls.IndexOf(otherToScript) - 1; StopIndex2 = mainStart.FindStopIndex(mode, 1f, mainStart.BaseSpeed, 0); if (mainStart.BaseSpeed < 0) { StopIndex2 = mainStart.FindStopIndex(mode, 1f, -mainStart.BaseSpeed, 0); } if (mode >= 0) { if ((interval * mainStart.GeneratedBalls [mode].c + interval * mainStart.GeneratedBalls [mode].t) - (interval * mainStart.GeneratedBalls [mode + 1].c + interval * mainStart.GeneratedBalls [mode + 1].t) > mainStart.distance * 0.99f && (interval * mainStart.GeneratedBalls [mode].c + interval * mainStart.GeneratedBalls [mode].t) - (interval * mainStart.GeneratedBalls [mode + 1].c + interval * mainStart.GeneratedBalls [mode + 1].t) < mainStart.distance * 3f) { StopIndex2 = mainStart.FindStopIndex(mode, 1f, mainStart.BaseSpeed, 0); if (mainStart.BaseSpeed < 0) { StopIndex2 = mainStart.FindStopIndex(mode, 1f, -mainStart.BaseSpeed, 0); } dmode = -1; } } } else { // Before this ball mode = mainStart.GeneratedBalls.IndexOf(otherToScript); StopIndex2 = mainStart.FindStopIndex(mode, 1f, mainStart.BaseSpeed, 0); if (mainStart.BaseSpeed < 0) { StopIndex2 = mainStart.FindStopIndex(mode, 1f, -mainStart.BaseSpeed, 0); } if (mode < mainStart.GeneratedBalls.Count - 2) { if ((interval * mainStart.GeneratedBalls [mode].c + interval * mainStart.GeneratedBalls [mode].t) - (interval * mainStart.GeneratedBalls [mode + 1].c + interval * mainStart.GeneratedBalls [mode + 1].t) > mainStart.distance * 1.01f) { dmode = 1; StopIndex2 = mainStart.FindStopIndex((mode - 1), 1f, mainStart.BaseSpeed, 0); if (mainStart.BaseSpeed < 0) { StopIndex2 = mainStart.FindStopIndex((mode - 1), 1f, -mainStart.BaseSpeed, 0); } } } } // start Coroutine for other work if (mainStart.BaseSpeed >= 0) { StartCoroutine(pGoInLine(other.gameObject.GetComponent <SpriteRenderer> ().sortingOrder)); } if (mainStart.BaseSpeed < 0) { StartCoroutine(nGoInLine(other.gameObject.GetComponent <SpriteRenderer> ().sortingOrder)); } mainStart.mode_IndexStop = mode; } } else if (other.gameObject.GetComponent <BallControl> () != null && gameObject.name == "throw ball" && This_destroyBall && other.gameObject.name != "ball under off") // if it`s object that can destroy a ball { once = true; if (GameObject.Find("Sound Center").GetComponent <SoundCenter> ().Bonus_Set_of_destroyBall != null) { GameObject.Find("SC 7").GetComponent <AudioSource> ().PlayOneShot(GameObject.Find("Sound Center").GetComponent <SoundCenter> ().Bonus_Set_of_destroyBall); } BallControl otherToScript = other.gameObject.GetComponent <BallControl> (); GetComponent <BallControl> ().ccObject = otherToScript.ccObject; GetComponent <BallControl> ().msScript = otherToScript.msScript; mainStart = otherToScript.msScript; int Indexofball = mainStart.GeneratedBalls.IndexOf(otherToScript); mainStart.GeneratedBalls.Remove(otherToScript); mainStart.CreateDestroyBall(otherToScript.gameObject); Vector3 ResultPosition = otherToScript.gameObject.transform.position; mainStart.GetComponent <ControlOfPl> ().AddScoreGlobal(mainStart.GetComponent <ControlOfPl> ().Score_Bonuse, otherToScript.GetComponent <SpriteRenderer> ().color, ResultPosition); Destroy(otherToScript.gameObject); mainStart.IndexStop = mainStart.FindStopIndex((mainStart.GeneratedBalls.Count - 2), 1f, mainStart.BaseSpeed, 0); mainStart.gameObject.GetComponent <ControlOfPl> ().SearchAvCollors(); if (Indexofball > 0 && Indexofball < mainStart.GeneratedBalls.Count - 1 && !mainStart.EndOfLine) { if (mainStart.GeneratedBalls [Indexofball].GetComponent <SpriteRenderer> ().color == mainStart.GeneratedBalls [Indexofball - 1].GetComponent <SpriteRenderer> ().color) { if (Indexofball > 1) { if (mainStart.GeneratedBalls [Indexofball - 1].GetComponent <SpriteRenderer> ().color == mainStart.GeneratedBalls [Indexofball - 2].GetComponent <SpriteRenderer> ().color) { mainStart.BaseSpeed = mainStart.saveBaseSpeed; mainStart.StartCoroutine(mainStart.CollisionInline(Indexofball - 1)); } } if (Indexofball < mainStart.GeneratedBalls.Count - 2) { if (mainStart.GeneratedBalls [Indexofball].GetComponent <SpriteRenderer> ().color == mainStart.GeneratedBalls [Indexofball + 1].GetComponent <SpriteRenderer> ().color) { mainStart.BaseSpeed = mainStart.saveBaseSpeed; mainStart.StartCoroutine(mainStart.CollisionInline(Indexofball - 1)); } } } } Destroy(gameObject); } // if`s fire if (other.gameObject.GetComponent <BallControl> () != null && gameObject.name == "throw ball" && This_fireBall) { BallControl otherToScript = other.gameObject.GetComponent <BallControl> (); GetComponent <BallControl> ().ccObject = otherToScript.ccObject; GetComponent <BallControl> ().msScript = otherToScript.msScript; mainStart = otherToScript.msScript; mainStart.GeneratedBalls.Remove(otherToScript); mainStart.CreateDestroyBall(otherToScript.gameObject); Vector3 ResultPosition = otherToScript.gameObject.transform.position; mainStart.GetComponent <ControlOfPl> ().AddScoreGlobal(mainStart.GetComponent <ControlOfPl> ().Score_Bonuse, otherToScript.GetComponent <SpriteRenderer> ().color, ResultPosition); Destroy(otherToScript.gameObject); mainStart.IndexStop = mainStart.FindStopIndex((mainStart.GeneratedBalls.Count - 2), 1f, mainStart.BaseSpeed, 0); mainStart.gameObject.GetComponent <ControlOfPl> ().SearchAvCollors(); } // if it`s arrow if (other.gameObject.GetComponent <BallControl> () != null && gameObject.name == "throw ball" && This_DestroyColor && other.gameObject.name != "ball under off") { once = true; if (GameObject.Find("Sound Center").GetComponent <SoundCenter> ().Bonus_Destroy_color != null) { GameObject.Find("SC 8").GetComponent <AudioSource> ().PlayOneShot(GameObject.Find("Sound Center").GetComponent <SoundCenter> ().Bonus_Destroy_color); } BallControl otherToScript = other.gameObject.GetComponent <BallControl> (); GetComponent <BallControl> ().ccObject = otherToScript.ccObject; GetComponent <BallControl> ().msScript = otherToScript.msScript; mainStart = otherToScript.msScript; Color Color_use = otherToScript.GetComponent <SpriteRenderer> ().color; int countGB = 0; List <BallControl> ListOfDel = new List <BallControl> { }; while (countGB < mainStart.GeneratedBalls.Count) { if (mainStart.GeneratedBalls [countGB].GetComponent <SpriteRenderer> ().color == Color_use && mainStart.GeneratedBalls [countGB].gameObject.name == "ball") { ListOfDel.Add(mainStart.GeneratedBalls [countGB]); } countGB++; } while (ListOfDel.Count > 0) { mainStart.GeneratedBalls.Remove(ListOfDel [0]); mainStart.CreateDestroyBall(ListOfDel [0].gameObject); Vector3 ResultPosition = ListOfDel [0].gameObject.transform.position; mainStart.GetComponent <ControlOfPl> ().AddScoreGlobal(mainStart.GetComponent <ControlOfPl> ().Score_Bonuse, otherToScript.GetComponent <SpriteRenderer> ().color, ResultPosition); Destroy(ListOfDel [0].gameObject); ListOfDel.Remove(ListOfDel [0]); } mainStart.gameObject.GetComponent <ControlOfPl> ().SearchAvCollors(); mainStart.IndexStop = mainStart.FindStopIndex((mainStart.GeneratedBalls.Count - 2), 1f, mainStart.BaseSpeed, 0); Destroy(gameObject); } } }