IEnumerator СubeToBlock() { yield return(new WaitForSeconds(MainCube.GetComponent <Animation>().clip.length - 0.5f)); BlockAnimations.Play(); MainCube.AddComponent <Rigidbody>(); }
public void Init(Vector2 loopDir, MainCube mainCube, GameObject lastObject) { collisionMask = lastObject; this.mainCube = mainCube; mainCube.GetComponent <CubeLooper>().loopCubes.Add(this); cubeAnimations.Loop(loopDir.y, loopDir.x, ControlTarget); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("MainCube") || other.gameObject.CompareTag("SecondCube")) { cube = FindObjectOfType <MainCube>(); StartCoroutine(Wait()); } }
void Start() { transform.parent.GetComponent <BoxCollider>().enabled = false; mainCube = GameObject.FindGameObjectWithTag("MainCube").GetComponent <MainCube>(); pointToMove = GameObject.FindGameObjectWithTag("PlatformPoint").transform.position; startPosition = this.transform.position; GameHandler gameHandler = GameObject.Find("GameHandler").GetComponent <GameHandler>(); gameHandler.OnRetryLevel += GameHandler_OnRetryLevel; }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("MainCube") || other.CompareTag("SecondCube")) { if (canGo) { mainCube = GameObject.FindGameObjectWithTag("MainCube").GetComponent <MainCube>(); StartCoroutine(wait()); } } }
IEnumerator Wait() { yield return(new WaitForSeconds(0.3f)); if (cube.IsVertical()) { movePlatform.Action(); } cube = null; yield break; }
void Start() { main = FindObjectOfType <MainCube> (); GameObject[] objs = GameObject.FindGameObjectsWithTag(this.gameObject.tag); foreach (GameObject obj in objs) { if (obj != this.gameObject) { targetPlatformToTeleport = obj; } } }
void OnMouseDown() { if (PlayerPrefs.GetInt("Money") >= PlayerPrefs.GetInt("Price")) //Условие проверки того, хватает ли игроку звёзд на покупку нового куба. { PlayerPrefs.SetString(CubeSeen.GetComponent <ChooseCube>().ChosenCube, "Available"); //У CubeSeen берётся из скрипта ChooseCube переменная, в которой записано имя выбранного на данный момент куба, куб записывается в PlayerPrefs как доступный. PlayerPrefs.SetInt("Money", PlayerPrefs.GetInt("Money") - PlayerPrefs.GetInt("Price")); //Уменьшение кол-ва звёзд на 50 как результат покупки. MainCube.GetComponent <MeshRenderer>().material = GameObject.Find(CubeSeen.GetComponent <ChooseCube>().ChosenCube).GetComponent <MeshRenderer>().material; //Нахождение материала выбранного куба и передача его основному кубу. PlayerPrefs.SetString("Now Cube", CubeSeen.GetComponent <ChooseCube>().ChosenCube); Bearer.GetComponent <AudioSource>().clip = Purchase; Bearer.GetComponent <AudioSource>().Play(); ChooseButton.SetActive(true); gameObject.SetActive(false); } }
public bool Undo() { while (cubeMoves.Count > 0) { MainCube cube = cubeMoves.Pop(); if (cube.isOnTarget) { cube.Undo(); return(true); } } return(false); }
public void RetryLevel() { countToAd++; MainCube mainCubeScript = GameObject.FindGameObjectWithTag("MainCube").GetComponent <MainCube>(); GameObject _MainCube = GameObject.FindGameObjectWithTag("MainCube"); StopAllCoroutines(); if (mainCubeScript.canMove) { if (_MainCube.name == "SecondCube") { mainCubeScript.ChangeCube(mainCubeScript.Main, mainCubeScript.Second); } _MainCube.transform.position = GameObject.FindGameObjectWithTag("Start").transform.GetChild(0).position; _MainCube.transform.rotation = mainCubeScript.Orig; } OnRetryLevelEvent(); if (winScreen.activeSelf) { winScreen.SetActive(false); } advMenu.GetComponent <AdvMenu>().AnimatePanel("Close"); stars.countCur = 0; Time.timeScale = 1; if (countToAd == 3) { countToAd = 0; if (ad.IsSupported) { ad.GetAd(); } } }
private void OnMouseDown() { if (!Clicked) { Clicked = true; StartCoroutine(DeleteCubes()); PlayText.gameObject.SetActive(false); StudyText.gameObject.SetActive(true); RecordText.gameObject.SetActive(true); Coins.gameObject.SetActive(true); GameText.text = "0"; Buttons.GetComponent <ScrollObject>().SpeedScrolling = -20f; Buttons.GetComponent <ScrollObject>().CheckPosition = -160f; transform.position = new Vector3(0, 0, -8); transform.localScale = new Vector3(10, 12, 2); StartCoroutine(СubeToBlock()); MainCube.GetComponent <Animation>().Play("StartMainCube"); CubesAnimations.Play(); } else if (Clicked && StudyText.gameObject.activeSelf) { StudyText.gameObject.SetActive(false); } }
public void Move(MainCube cube) { cubeMoves.Push(cube); }
public void RefreshTarget(MainCube script) { cubeScript = null; cubeScript = script; }