// Start is called before the first frame update // Acts as a initialzing method. void Start() { var temp = GameObject.FindGameObjectWithTag("DayController"); if (temp != null) { dayController = temp.GetComponent <DayController>(); dayController.Subscribe(this); dayCycle = dayController.GetDayCycle(); //Sets initial state SetSpawnState(); } spawnPoints = FindObjectOfType <MoveSpots>(); }
// Start is called before the first frame update void Start() { seeker = GetComponent <Seeker>(); rb = GetComponent <Rigidbody2D>(); target = GameObject.FindGameObjectWithTag("Player").transform; patrol = FindObjectOfType <MoveSpots>(); //find the possible spots to move to randomSpot = Random.Range(0, patrol.movespots.Length); //choose a random spot if (isChasing) { speed = chaseSpeed; } else { speed = patrolSpeed; } InvokeRepeating("UpdatePath", 0f, .5f); }