private void Start() { slowmoClass = slowmotion.GetComponent <Slowmotion>(); playerClass = GetComponent <Player>(); playerStats = FindObjectOfType <PlayerStatistics>(); //objectPooler = ObjectPooler.Instance; }
private void Start() { int numCircles = circlePlacement.Count; int numLines = linePlacement.Count; slowmotion = slowMotionGO.GetComponent <Slowmotion>(); for (int i = 0; i < numCircles; i++) { List <Vector3> points = Utils.DrawCircle(circlePlacement[i].xCoordinate, circlePlacement[i].yCoordinate, circlePlacement[i].adjustWrtBorders, circlePlacement[i].radius, circlePlacement[i].circleBorderWidth); int numPoints = points.Count; int assignedIndex = 0; int differenceBetweenIndex = numPoints / circlePlacement[i].count; for (int j = 0; j < circlePlacement[i].count; j++) { GameObject objRevolving = Instantiate(circlePlacement[i].objectType, points[assignedIndex], transform.rotation); objRevolving.name = circlePlacement[i].objectType.name + " on circle"; objRevolving.GetComponentInChildren <Animator>().runtimeAnimatorController = rotateAnimationController; PlaceObjects objectPlacementScript = objRevolving.GetComponent <PlaceObjects>(); objectPlacementScript.isObjectAFreeBird = true; objectPlacementScript.scalingRequired = false; objectPlacementScript.TriggerPlacementOnLine(points, assignedIndex, false); assignedIndex = (assignedIndex + differenceBetweenIndex) % numPoints; slowmotion.gameEntities.Add(objRevolving); } } for (int i = 0; i < numLines; i++) { Vector3 firstPoint = linePlacement[i].firstPoint, secondPoint = linePlacement[i].secondPoint; if (linePlacement[i].placeWrtCorners) { var bottomLeft = mainCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)); var bottomRight = mainCamera.ViewportToWorldPoint(new Vector3(1, 0, 0)); firstPoint.x = bottomLeft.x + cornerOffset; secondPoint.x = bottomRight.x - cornerOffset; } Utils.DrawLine(firstPoint, secondPoint, endPointsSprite); GameObject objMoving = Instantiate(linePlacement[i].objectType, (linePlacement[i].objectSpawnPoint == 0) ? firstPoint : secondPoint, transform.rotation); objMoving.GetComponentInChildren <Animator>().runtimeAnimatorController = rotateAnimationController; objMoving.name = linePlacement[i].objectType.name + " on line"; PlaceObjects objectPlacementScript = objMoving.GetComponent <PlaceObjects>(); objectPlacementScript.isObjectAFreeBird = true; objectPlacementScript.scalingRequired = false; objectPlacementScript.leftRightOffset = 0f; objectPlacementScript.TriggerPlacementOnLine(new List <Vector3>() { firstPoint, secondPoint }, linePlacement[i].objectSpawnPoint, true); slowmotion.gameEntities.Add(objMoving); } }
void Start() { dragIndication = Instantiate(dragIndication); dragLine = dragIndication.GetComponent <LineRenderer>(); dragOutter = dragIndication.transform.GetChild(0); dragInner = dragIndication.transform.GetChild(1); dragCrossParts[0] = dragInner.transform.GetChild(0).GetComponent <SpriteRenderer>(); dragCrossParts[1] = dragInner.transform.GetChild(1).GetComponent <SpriteRenderer>(); dragIndication.SetActive(false); rb = GetComponent <Rigidbody2D>(); line = trajectory.GetComponent <LineRenderer>(); slowmotion = FindObjectOfType <Slowmotion>(); mainLogic = FindObjectOfType <GameLoop>(); originalPos = transform.position; }
private void Start() { slowmotionClass = slowmotion.GetComponent <Slowmotion>(); playerClass = player.GetComponent <Player>(); playerActionsClass = player.GetComponent <PlayerActions>(); coinsAcquiredOnScreenText = coinsAcquired.GetComponent <TextMeshProUGUI>(); coinsInScene = FindObjectsOfType <Coin>().Length; coinsAcquiredOnScreenText.text = currentCoinsAcquired.ToString() + " / " + coinsInScene; playerStats = FindObjectOfType <PlayerStatistics>(); taskHandler = FindObjectOfType <TaskHandler>(); prevLowerBound = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, 0)).y; playSpaceCollider = playSpace.GetComponent <PolygonCollider2D>(); gameLinesClass = gameLines.GetComponent <GameLines>(); levelCompletedText = levelCompletedTextGO.GetComponent <TextMeshProUGUI>(); PersistentInformation.LevelIdentifier = gameObject.scene.name; pg = FindObjectOfType <ProceduralGeneration>(); initialTimeForAdButtonAnimation = timeForAdButtonAnimation; adMobClass = FindObjectOfType <AdMob>(); adMobClass.RequestRewardBasedVideo(); adMobClass.RequestInterstitial(); }
protected override void Awake() { base.Awake(); m_slowmotion = m_player.GetComponent <Slowmotion>(); }
private void Awake() { slowmoClass = slowmotionGO.GetComponent <Slowmotion>(); }