// FixedUpdate is called once for physics frame void FixedUpdate() { if (CurrentGameState == GameState.SWEEPING) { ActiveRock.GetComponent <Rock>().UseReducedFriction = Utils.GetKey_Confirm(); if (Utils.GetKey_Confirm()) { Rigidbody2D rb = ActiveRock.GetComponent <Rigidbody2D>(); rb.velocity += new Vector2(0f, Sweeper.GetComponent <Sweeper>().SweepOffset.y *rb.velocity.magnitude *SWEEP_COEF); } } }
void StartThrow() { ActiveRock = Instantiate(RockPrefab); rocks.Add(ActiveRock); ActiveRock.GetComponent <Rock>().Team = GetCurrentTeam(); ActiveRock.GetComponent <Rock>().Minimap = Minimap; ActiveRock.GetComponent <Rock>().InstantiateIndicator(); Thrower.GetComponent <SpriteRenderer>().sprite = GetCurrentTeam().AimSprite; Sweeper.GetComponent <SpriteRenderer>().sprite = GetCurrentTeam().SweepSprite; Sweeper.GetComponent <Sweeper>().ResetOffsets(); trajectory = Instantiate(TrajectoryPrefab); trajectoryIndicator = Instantiate(TrajectoryIndicatorPrefab); trajectory.transform.SetParent(ActiveRock.transform); trajectoryIndicator.transform.SetParent(ActiveRock.GetComponent <Rock>().Indicator.transform); trajectory.transform.localPosition = new Vector3(); trajectoryIndicator.transform.localPosition = new Vector3(); CurrentGameState = GameState.AIMING; if (CurrentTurn == Turn.P1 ? GameConfig.P1ShowTutorial : GameConfig.P2ShowTutorial) { helpStage = HelpScreen.ID.SCORING; } }