void Start() { goingHome = false; //gets our first state as begin state iActiveBugState = new BeginBugState(this); //so we can change it from WanderState bugLight = this.GetComponent <Light>(); if (iActiveBugState != null) { iActiveBugState.Enter(); } //get bug manager primarily to refrence bug attract points bugManager = GameObject.FindGameObjectWithTag("BugManager"); bugMan = bugManager.GetComponent <BugManager>(); //copying our vector3 arrays from bug manager, wish I knew how to do this earlier bugAttractors.AddRange(bugMan.bugAttractors); spawnPoints.AddRange(bugMan.spawnPointLocations); }
public void SwitchState(IBugState newState) { iActiveBugState.Exit(); iActiveBugState = newState; iActiveBugState.Enter(); }