void Start() { SelectDirection(); //Select direction for waveracer desiredDirection = waveracerDirection.horizontal; UpdateState("newTarget"); //Set state machine state //Define Arena Dimensions - Must be Performed in Start() as ArenaScaler Calculates Offsets in Awake() arenaBufferSize = ArenaScaler.Instance.GetColliderBufferSize(); arenaMinX = ArenaScaler.Instance.GetArenaBoundary("minX"); arenaMaxX = ArenaScaler.Instance.GetArenaBoundary("maxX"); arenaMinY = ArenaScaler.Instance.GetArenaBoundary("minY"); arenaMaxY = ArenaScaler.Instance.GetArenaBoundary("maxY"); }
private void SelectDirection() { float randValue = UnityEngine.Random.value; //Effectively flips a pseudo-random coin - MUST define UnityEngine.Random, as System Namespace is used, which contains a seperate Random definition if (randValue < 0.5f) { desiredDirection = waveracerDirection.horizontal; //Set Direction to Horizontal } else { desiredDirection = waveracerDirection.vertical; //Set Direction to Vertical } }