void Start() { progressBar = GameObject.Find("RadialProgressBar"); CoinPlus = 0; hold = GameObject.Find("HoldPanel"); survivePanel = GameObject.Find("Survive Panel"); survivePanel.GetComponentInChildren <ProgressOficial>().Speed = 0; ScoreText = GameObject.Find("Score").GetComponent <Text>(); PlayerPrefs.SetInt("coinplus", 0); this.Points = new Vector3[2] { GameObject.Find("lu").transform.position, GameObject.Find("rd").transform.position }; ScreenAndCam = GameObject.Find("Main Camera").GetComponent <ScreenAndCamera>(); Time.timeScale = 1; MultipleCoinAmount = 1; _coin = 0; score = 0; ScoreText.text = "0"; startGift = Random.Range(5, 11); LastScoreText = GameObject.Find("Last Score Text").GetComponent <Text>(); LastScoreText.text = (PlayerPrefs.GetInt("LastScore", 0)).ToString(); State = GameStatus.Start; HighScore = PlayerPrefs.GetInt("HighScore", HighScore); Coin = PlayerPrefs.GetInt("Coin", Coin); CoinText = GameObject.Find("Coin Text").GetComponent <Text>(); CoinText.text = Coin.ToString(); giftActs = new GiftActs(gameObject, progressBar, blooooooooock, GiftMusic); Blocks = new BlockPlatformer(Block, BlockDistance); //_gift = new Gift(this.Gift, this.Points, this.progressBar); new GameSparks.Api.Requests.LogEventRequest().SetEventKey("LEADERBOARD_SCORER").SetEventAttribute("SCORER", int.Parse(PlayerPrefs.GetInt("HighScore", 0).ToString())).Send((response) => { if (!response.HasErrors) { Debug.Log("Score Posted Successfully..."); } else { Debug.Log("Error Posting Score..."); } }); }
/// <summary> /// Dashs in Game without Collision. /// </summary> /// <param name="Velocity">Sets the Velocity of Player Dashing.</param> /// <returns>Returns the Current Speed of Player.</returns> public void InfiniteDash(DashVelocity Velocity, ScreenAndCamera cam) { Action = CurrentAction.InfiniteDash; this.Velocity = (int)Velocity; this.ProgressBar.SetActive(true); this.ProgressBar.GetComponent <ProgressBar>().ProgressStart(); halo.enabled = true; BoxCollider2D[] col = this.Blocks[0].GetComponents <BoxCollider2D>(); for (int i = 0; i < col.Length; i++) { if (col[i].isTrigger) { col[i].size = new Vector2(20, col[i].size.y); continue; } else { col[i].enabled = false; } } col = this.Blocks[1].GetComponents <BoxCollider2D>(); for (int i = 0; i < col.Length; i++) { if (col[i].isTrigger) { col[i].size = new Vector2(20, col[i].size.y); continue; } else { col[i].enabled = false; } } print(cam.gameObject.GetComponent <Rigidbody2D>().velocity.y); //cam.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(0, cam.gameObject.GetComponent<Rigidbody2D>().velocity.y + this.Velocity); cam.ChangeSpeed(this.Velocity); print(cam.gameObject.GetComponent <Rigidbody2D>().velocity.y); }
/// <summary> /// Ends work of InfiniteDash. /// </summary> public void EndInfiniteDash(ScreenAndCamera cam) { Action = CurrentAction.Nothing; //cam.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(0, cam.gameObject.GetComponent<Rigidbody2D>().velocity.y - this.Velocity); cam.ChangeSpeed(-this.Velocity); halo.enabled = false; BoxCollider2D[] col = this.Blocks[0].GetComponents <BoxCollider2D>(); for (int i = 0; i < col.Length; i++) { if (col[i].isTrigger) { col[i].size = new Vector2(2.07f, col[i].size.y); continue; } else { col[i].enabled = true; } } col = this.Blocks[1].GetComponents <BoxCollider2D>(); for (int i = 0; i < col.Length; i++) { if (col[i].isTrigger) { col[i].size = new Vector2(2.07f, col[i].size.y); continue; } else { col[i].enabled = true; } } }