void Awake() { resetIncreaseInterval = increaseInterval; initialInverseTimer = inverseTimer; cubeSpawner = GameObject.FindGameObjectWithTag("LineSpawner").GetComponent <CubeSpawner>(); }
private void Update() { for (int i = 0; i < Input.touchCount; i++) { if (Input.GetTouch(0).phase == TouchPhase.Began) { if (CubeMovement.CurrentCube != null) { CubeMovement.CurrentCube.Stop(); } spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawner[spawnerIndex]; currentSpawner.Spawn(); if (!isGameStart) { TapToStartText.gameObject.SetActive(false); scoreText.gameObject.SetActive(true); } if (isGameStart) { Camera.main.GetComponent <CameraFollowing>().posY += 0.1f; score++; scoreText.text = score.ToString(); } isGameStart = true; } } }
void SpawnBetterCube() { int selectValue = Mathf.RoundToInt(Mathf.Lerp(1, Simulation.Instance.highestCubeLevel - 1, Random.value)); Debug.Log("SelectValue: " + selectValue); CubeSpawner spawnerThatCanSpawn = null; CubeSpawner testedSpawner = this; while (spawnerThatCanSpawn == null && testedSpawner.nextSpawner != null) { if (selectValue <= testedSpawner.maxLevel) { spawnerThatCanSpawn = testedSpawner; } else { testedSpawner = testedSpawner.nextSpawner; } } if (spawnerThatCanSpawn == null) { Debug.LogWarning("No spawner for cube level: " + selectValue + " could be found. Spawning a basic block instead."); SpawnCube(); } else { luckyLabel.gameObject.SetActive(true); luckyLabel.SetLevel(selectValue); spawnerThatCanSpawn.SpawnCube(selectValue); } }
public void SetRow(int num, CubeSpawner spawner, ScriptedSpawner s, DoubleSpawner d) { row = num; spawnerScript = spawner; doubleS = d; scripted = s; }
public void FakePlacement() { if (someScriptHolder.gameIsPaused == false) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } if (missCount >= 3) { //LastCube = null; //CurrentCube = null; //SceneManager.LoadScene(0); loseScreen.SetActive(true); } else { spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); OnCubeSpawned(); if (cubeSpeed <= finalCubeSpeed) { cubeSpeed += speedIncrement; } } } }
// Use this for initialization void Start() { C = this; for (int i = 0; i < numCubes; i++) { cubes.Add(Instantiate(cubePrefab).GetComponent<Cube>()); } }
// Use this for initialization void Start() { C = this; for (int i = 0; i < numCubes; i++) { cubes.Add(Instantiate(cubePrefab).GetComponent <Cube>()); } }
void Awake() { lineSpawner = GameObject.FindGameObjectWithTag("LineSpawner").GetComponent <CubeSpawner>(); musicManager = GameObject.FindGameObjectWithTag("MusicManager").GetComponent <MusicManager>(); scoreManager = GameObject.FindGameObjectWithTag("ScoreManager").GetComponent <ScoreManager>(); difficultyManager = GameObject.FindGameObjectWithTag("DifficultyManager").GetComponent <DifficultyManager>(); playerController = GameObject.Find("Player").GetComponent <PlayerController>(); }
void Awake() { if (instance == null) { instance = this; } coll = GetComponent <BoxCollider>(); }
private void Awake() { if (instance == null) { instance = this; } SpawnCube(); SpawnPasifCube(); }
public override void Init() { m_cubeChecker = this.GetComponentInParent <CubeChecker>().GetCubeChecker(); m_cubeSpawner = this.GetComponentInParent <CubeChecker>().GetCubeSpawner(); //m_cubeChecker = GetComponent<CubeChecker>().GetCubeChecker(); //m_cubeSpawner = GetComponent<CubeChecker>().GetCubeSpawner(); m_meshRenderer = GetComponent <MeshRenderer>(); m_meshRenderer.material.color = m_cubeSpawner.CubeColors[0]; m_colorIndex = 0; }
private void Start() { cubespawner = Terrain.GetComponent <CubeSpawner>(); cubeGoal = cubespawner.Cubes[12, 2].transform; endPos = cubeGoal.position - new Vector3(0, 3, 0); cubePlayer2.GetComponent <Renderer>().material.SetFloat("_OutlineWidth", 1.1f); cubeRotator = (new GameObject("cubeRotator")).transform; uicontroller = Terrain.GetComponent <UIController>(); }
private void OnMouseDown() { GameManager gm = GameManager.Instance; CubeSpawner cs = gm.lm.cubeSpawner; int givenScore = Mathf.CeilToInt(transform.position.z - cs.transform.position.z + cs.transform.localScale.z / 2.0f / 5.0f) + 1; gm.AddScore(givenScore); gameObject.SetActive(false); }
/// <summary> /// Старт игры / рождение платформы /// </summary> private void StartGame() { Debug.Log(GameStatus.ToString()); if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } currentSpawner = spawners[UnityEngine.Random.Range(0, spawners.Length)]; currentSpawner.SpawnCube(); OnCubeSpawned(); camera.Next_Position(currentSpawner.transform.localScale.y); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } trans = GetComponent <Transform>(); CreateBlockFromImage(trans); }
void Update() { if (Input.GetButtonDown("Fire1")) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); } }
private void Update() { if (Input.GetMouseButtonDown(0)) { if (MovingCube.currentCube != null) { MovingCube.currentCube.StopCube(); } spawner_index = spawner_index == 0 ? 1 : 0; currentSpawner = spawners[spawner_index]; currentSpawner.SpawnCube(); _score.IncreaseScore(); } }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { } blockSpawner = GetComponent <BlockSpawner>(); cubeSpawner = GetComponent <CubeSpawner>(); groundSpawner = GetComponent <GroundSpawner>(); }
void Update() { if (Input.GetKeyDown(KeyCode.Space)) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); OnCubeSpawned(); } }
void Awake() { cubeSpawner = GameObject.FindGameObjectWithTag("LineSpawner").GetComponent <CubeSpawner>(); playerController = GameObject.Find("Player").GetComponent <PlayerController>(); scoreManager = GameObject.FindGameObjectWithTag("ScoreManager").GetComponent <ScoreManager>(); particleController = GameObject.FindGameObjectWithTag("ParticleController").GetComponent <RotateParticles>(); uiManager = GameObject.FindGameObjectWithTag("UIManager").GetComponent <UIManager>(); burstParticles = GameObject.FindGameObjectWithTag("BurstParticleController").GetComponent <BurstParticleController>(); transform.localScale = new Vector3(PlayerController.aspectScale, transform.localScale.y, PlayerController.aspectScale); rotateSpeed = playerController.rotateSpeed; int randColor = Random.Range(1, 6); switch (randColor) { case 1: GetComponent <Renderer>().material = cubeSpawner.colorArray[0]; tag = "Red"; break; case 2: GetComponent <Renderer>().material = cubeSpawner.colorArray[1]; tag = "Blue"; break; case 3: GetComponent <Renderer>().material = cubeSpawner.colorArray[2]; tag = "Yellow"; break; case 4: GetComponent <Renderer>().material = cubeSpawner.colorArray[3]; tag = "Green"; break; case 5: GetComponent <Renderer>().material = cubeSpawner.colorArray[4]; tag = "Purple"; break; default: Debug.Log("Something went wrong within the switch @ " + this); break; } }
//Poll starts here... IEnumerator RunPoll() { ContentManager content = ContentManager.Instance; CubeSpawner spawner = CubeSpawner.Instance; SideMenu sideMenu = SideMenu.Instance; CenterScreen centerScreen = CenterScreen.Instance; CenterMenu centerMenu = CenterMenu.Instance; LeftMenu leftMenu = LeftMenu.Instance; RightMenu rightMenu = RightMenu.Instance; yield return(new WaitForSeconds(m_pollWindowWaitTime)); Player.ShowMoveCubeText = true; rightMenu.ShowBackground(true); centerMenu.ShowBackground(true); leftMenu.ShowBackground(true); yield return(new WaitForSeconds(1.2f)); //Set poll question and responses... m_pollQuestionCounter = (m_pollQuestionCounter + 1) % content.PollAList.Count; m_poll = content.PollAList[m_pollQuestionCounter]; content.OpenConnection(); m_answerInfo = (AOrBAnswerInfo)content.GetPollAnswersA(m_poll.Question_Id); content.CloseConnection(); centerScreen.HeaderText.text = m_poll.Question; centerMenu.ActivePollAAnswer.text = m_poll.Answer_a; centerMenu.InactivePollAAnswer.text = m_poll.Answer_a; rightMenu.ActivePollAAnswer.text = m_poll.Answer_b; rightMenu.InactivePollAAnswer.text = m_poll.Answer_b; yield return(new WaitForSeconds(m_showPollWaitTime)); centerScreen.ShowHeader(true); centerMenu.ShowPollA(true); rightMenu.ShowPollA(true); PanelManager.Instance.ClearPanel(1); PanelManager.Instance.ClearPanel(2); m_yesNoActive = true; StartCoroutine(RunPollCountdown()); }
private void Update() { if (Input.GetButtonDown("Fire1")) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.StopCube(); } _spawnerIndex = _spawnerIndex == 0 ? 1 : 0; _currentSpawner = _spawners[_spawnerIndex]; _currentSpawner.SpawnCube(); onCubeSpawned(); } }
void Awake() { cubeSpawner = GameObject.FindGameObjectWithTag("LineSpawner").GetComponent <CubeSpawner>(); particleController = GameObject.FindGameObjectWithTag("ParticleController").GetComponent <RotateParticles>(); aspectScale = Camera.main.aspect; transform.localScale = new Vector3(aspectScale, aspectScale, aspectScale); float distance = transform.position.z - Camera.main.transform.position.z; Vector3 leftMostSide = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, distance)); Vector3 rightMostSide = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, distance)); xMin = leftMostSide.x + screenPadding; xMax = rightMostSide.x - screenPadding; initialRotateSpeed = rotateSpeed; ChangeColor(); }
private void spawnDropCube(float dropCubePosition, float dropCubeSize) { var dropCube = GameObject.CreatePrimitive(PrimitiveType.Cube); dropCube.GetComponent <Renderer>().material.color = MyCube.currentCube.GetComponent <Renderer>().material.color; if (CubeSpawner.startSpawnDirection == SpawnDirection.LEFT) { dropCube.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, dropCubePosition); dropCube.transform.localScale = new Vector3(target.transform.localScale.x, target.transform.localScale.y, dropCubeSize); } else if (CubeSpawner.startSpawnDirection == SpawnDirection.RIGHT) { dropCube.transform.position = new Vector3(dropCubePosition, target.transform.position.y, target.transform.position.z); dropCube.transform.localScale = new Vector3(dropCubeSize, target.transform.localScale.y, target.transform.localScale.z); } CubeSpawner.changeStartSpawnDirection(); dropCube.AddComponent <Rigidbody>(); dropCube.AddComponent <RemoveCube>(); }
void Update() { switch (gameState) { case GameState.StartGame: scoreText.SetMenuText(); break; case GameState.SpawnCube: if (!MovingCube.StopSpawnCube) { spawnerIndex = UnityEngine.Random.Range(0, cubeSpawners.Length); currentSpawner = cubeSpawners[spawnerIndex]; currentSpawner.SpawnCube(); CameraMove(); gameState = GameState.CropCube; } break; case GameState.CropCube: break; } if (Input.GetMouseButtonDown(0) && gameState == GameState.StartGame) { gameState = GameState.SpawnCube; } if (Input.GetMouseButtonDown(0) && gameState == GameState.CropCube) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); OnCubeSpawned?.Invoke(); gameState = GameState.SpawnCube; } } }
protected virtual void Update() { //TODO: Fade Text alpha if (m_canvasGroups != null) { CubeSpawner spawner = CubeSpawner.Instance; Transform cameraT = Camera.main.transform; Vector3 toPoint = transform.position - cameraT.position; float distFromCamera = Vector3.Dot(cameraT.forward, toPoint); float alpha = 1; if (distFromCamera > spawner.AmountDistToFade) { float fadeDist = distFromCamera - spawner.StartFadeDistance; alpha -= Mathf.Min(fadeDist / spawner.AmountDistToFade); } foreach (CanvasGroup group in m_canvasGroups) { group.alpha = alpha; } } }
private void Update() { if (Input.GetButtonDown("Fire1")) { if (someScriptHolder.gameIsPaused == false) { if (MovingCube.CurrentCube != null) { MovingCube.CurrentCube.Stop(); } if (missCount >= 3) { //LastCube = null; //CurrentCube = null; //SceneManager.LoadScene(0); loseScreen.SetActive(true); } else { spawnerIndex = spawnerIndex == 0 ? 1 : 0; currentSpawner = spawners[spawnerIndex]; currentSpawner.SpawnCube(); OnCubeSpawned(); if (cubeSpeed <= finalCubeSpeed) { cubeSpeed += speedIncrement; } //MovingCube.moveSpeed = cubeSpeed; } //Test For Placement Zones /* * * get ingredient object * reference PlacementZoneCheck.difference * if (difference <= perf) * { * * run snap function * * } * else if (difference >= miss) * { * missCount++; * } * else * { * * } * * * */ } } }
// Use this for initialization void Start() { spawner = GameObject.FindGameObjectWithTag("CubeSpawner").GetComponent <CubeSpawner>(); }
private void Awake() { cubeSpawner = GetComponent <CubeSpawner>(); }
void RayCast() { { int layerMask = 100; int x = Screen.width / 2; int y = Screen.height / 2; Camera Cam = CameraObject.GetComponent <Camera>(); Ray ray = Cam.ScreenPointToRay(new Vector3(x, y)); RaycastHit hit; if (Physics.Raycast(ray, out hit, layerMask)) { PickUp p = hit.collider.GetComponent <PickUp>(); if (p != null) { if (Input.GetMouseButtonDown(0)) { if (UseGun(FreezeChargeCost)) { p.FreezeObject(); //AudioPlayer.clip = TM_Effect; //print("Freeze Object"); //if (CurrentCharge < 20f) //{ //vignette.color.value = new Color(0, 217, 255, 5); //vignette.color.value = Color.black; // vignette.intensity.value = 0.268f; // vignette.color.Interp(Color.black, new Color(0, 217, 255, 5), 0.01f); // } } } else if (hit.distance < 8f && Input.GetMouseButtonDown(1)) { //if (UseGun(PickupChargeCost)) //{ print("Pickup Object"); p.PickupObject(); ArbiterHolder.Play("Fire"); //} } else if (Input.GetMouseButtonDown(2)) { //if (UseGun(PickupChargeCost)) //{ if (savedVelocity == new Vector3(0, 0, 0)) { savedVelocity = p.VelocityTake(); } else { p.VelocityApply(savedVelocity); savedVelocity = new Vector3(0, 0, 0); } //} } return; } else { print(hit.collider.tag); CubeSpawner CS = hit.collider.GetComponent <CubeSpawner>(); if (CS != null) { if (Input.GetMouseButtonDown(0)) { CS.RespawnCube(); } return; } SwitchToggle ST = hit.collider.GetComponent <SwitchToggle>(); if (ST != null) { // print("1"); if (Input.GetMouseButtonDown(1)) { //print("2"); UseGun(ST.Toggle()); } else { if (ST.resetable) { UseGun(ST.Reset()); } } return; } PowerSource PS = hit.collider.GetComponent <PowerSource>(); if (PS != null & Input.GetMouseButtonDown(1)) { // print("1"); if (Input.GetMouseButtonDown(1)) { //print("2"); if (PS.Use()) { CurrentCharge = MaxCharge; } } return; } } UseGun(0); AudioSource.PlayOneShot(Miss); } } }
// Start is called before the first frame update void Start() { player = GameObject.FindWithTag("Player").GetComponent <PlayerController>(); levelController = gameObject.GetComponent <LevelController>(); spawner = gameObject.GetComponent <CubeSpawner>(); }
void Awake() { cubeSpawner = this; timer = this.GetComponent<Timer> (); if (!timer) { gameObject.AddComponent<Timer>(); timer = this.GetComponent<Timer> (); } anim = this.GetComponent<Animator> (); if (PlayerPrefs.HasKey ("HighScoreEasy")) { HighScoreEasy = PlayerPrefs.GetInt ("HighScoreEasy"); } else { HighScoreEasy = 0; PlayerPrefs.SetInt("HighScoreEasy",HighScoreEasy); } if (PlayerPrefs.HasKey ("HighScoreMed")) { HighScoreMed = PlayerPrefs.GetInt ("HighScoreMed"); } else { HighScoreMed = 0; PlayerPrefs.SetInt("HighScoreMed",HighScoreMed); } if (PlayerPrefs.HasKey ("HighScoreHard")) { HighScoreHard = PlayerPrefs.GetInt ("HighScoreHard"); } else { HighScoreHard = 0; PlayerPrefs.SetInt("HighScoreHard",HighScoreHard); } if (PlayerPrefs.HasKey ("HighScoreO_x")) { HighScoreO_x = PlayerPrefs.GetInt ("HighScoreO_x"); } else { HighScoreO_x = 0; PlayerPrefs.SetInt("HighScoreO_x",HighScoreO_x); } }