// Use this for initialization void Start() { UIGameManager.instance.mainCameraLocation = transform; hook = GameManager.instance.hook; player = GameManager.instance.player; GameManager.instance.fish = this; myRigidbody = GetComponent <Rigidbody2D>(); lineRenderer = hook.GetComponent <LineRenderer>(); if (GameManager.instance.fishDetect.gameObject.activeSelf) { GameManager.instance.fishDetect.gameObject.SetActive(false); } fishData = GameManager.instance.GetFishDataById(GameManager.instance.currentSpawnedFish.id); patterns = fishData.patterns; //==== Random Pattern ===== moveForce = fishData.moveForce; //based on the fish maxSpeed = fishData.maxSpeed; //based on the fish timeBetweenMove = fishData.timeBetweenMove; //based on the fish timeToMove = fishData.timeToMove; //based on the fish decelerateSpeed = fishData.decelerateSpeed; //based on the fish timeBetweenMoveCounter = Random.Range(timeBetweenMove * 0.75f, timeBetweenMove * 1.25f); //Randomizes a bit of the timer that the fish stops to move again timeToMoveCounter = Random.Range(timeToMove * 0.75f, timeBetweenMove * 1.25f); //Randomizes a bit of the timer that the fish keep moving //==== Circle Pattern ===== angle = 0; radius = fishData.radius; circleSpeed = fishData.circleSpeed; //==== Square Pattern ===== acceleration = 2.5f; deceleration = 5f; squarePatternReady = false; speed = 2f; //==== Overall ===== waypointAux = false; InvokeRepeating("changePattern", 3F, 3F); changePattern(); currentDrag = 0; color = new Color32(255, 255, 255, 255); }