/// <summary> /// Called on Awake /// </summary> protected override void Awake() { base.Awake(); this.WarnIfMultipleInstances(); _transform = this.transform; _wayPoints = new SimpleQueue <Vector3>(); _pathboundWayPoints = new SimpleQueue <Vector3>(); _navMessage = new UnitNavigationEventMessage(this.gameObject); _resultProcessors = this.GetComponents <SteerForPathResultProcessorComponent>(); Array.Sort(_resultProcessors, (a, b) => a.processingOrder.CompareTo(b.processingOrder)); _unit = this.GetUnitFacade(); _pathSettings = _unit.pathNavigationOptions; if (this.arrivalDistance > _pathSettings.nextNodeDistance) { Debug.LogError("The Arrival Distance must be equal to or less that the Next Node Distance."); } _stopped = true; _unit.hasArrivedAtDestination = true; }
/// <summary> /// Called on Awake /// </summary> protected override void Awake() { base.Awake(); this.WarnIfMultipleInstances(); _transform = this.transform; _wayPoints = new WaypointList(); _navMessage = new UnitNavigationEventMessage(this.gameObject); _resultProcessors = this.GetComponents <SteerForPathResultProcessorComponent>(); Array.Sort(_resultProcessors, (a, b) => a.processingOrder.CompareTo(b.processingOrder)); _unit = this.GetUnitFacade(); _pathSettings = _unit.pathNavigationOptions; _stopped = true; }
public virtual void Initialize(GameObject unitObject) { _props = unitObject.As <IUnitProperties>(false, true); _movable = unitObject.As <IMovable>(false, false); _moving = unitObject.As <IMovingObject>(false, true); _speeder = unitObject.As <IDefineSpeed>(false, true); _pathFinderOptions = unitObject.As <IPathFinderOptions>(false, false) ?? new PathFinderOptions(); _pathNavOptions = unitObject.As <IPathNavigationOptions>(false, false) ?? new PathNavigationOptions(); this.isMovable = _movable != null; if (!this.isMovable) { _movable = new MovableDummy(unitObject.name); } this.gameObject = unitObject; this.transform = unitObject.transform; this.collider = unitObject.GetComponent <Collider>(); }
/// <summary> /// Initializes the Unit Facade. /// </summary> /// <param name="unitObject">The unit game object.</param> public virtual void Initialize(GameObject unitObject) { _props = unitObject.As<IUnitProperties>(false, true); _movable = unitObject.As<IMovable>(false, false); _moving = unitObject.As<IMovingObject>(false, true); _speeder = unitObject.As<IDefineSpeed>(false, true); _pathFinderOptions = unitObject.As<IPathFinderOptions>(false, false) ?? new PathFinderOptions(); _pathNavOptions = unitObject.As<IPathNavigationOptions>(false, false) ?? new PathNavigationOptions(); this.isMovable = _movable != null; if (!this.isMovable) { _movable = new MovableDummy(unitObject.name); } this.gameObject = unitObject; this.transform = unitObject.transform; this.collider = unitObject.GetComponent<Collider>(); this.isAlive = true; this.hasArrivedAtDestination = true; }
/// <summary> /// Called on Awake /// </summary> protected override void Awake() { base.Awake(); this.WarnIfMultipleInstances(); _transform = this.transform; _wayPoints = new WaypointList(); _navMessage = new UnitNavigationEventMessage(this.gameObject); _resultProcessors = this.GetComponents<SteerForPathResultProcessorComponent>(); Array.Sort(_resultProcessors, (a, b) => a.processingOrder.CompareTo(b.processingOrder)); _unit = this.GetUnitFacade(); _pathSettings = _unit.pathNavigationOptions; _stopped = true; }
private IEnumerator delayToInit() { yield return new WaitForSeconds(0.5f); this.WarnIfMultipleInstances(); _unit = this.GetUnitFacade(); _pathSettings = _unit.pathNavigationOptions; _stopped = true; }
/// <summary> /// Called on Awake /// </summary> protected override void Awake() { base.Awake(); this.WarnIfMultipleInstances(); _transform = this.transform; _wayPoints = new SimpleQueue<Vector3>(); _pathboundWayPoints = new SimpleQueue<Vector3>(); _navMessage = new UnitNavigationEventMessage(this.gameObject); _resultProcessors = this.GetComponents<SteerForPathResultProcessorComponent>(); Array.Sort(_resultProcessors, (a, b) => a.processingOrder.CompareTo(b.processingOrder)); _unit = this.GetUnitFacade(); _pathSettings = _unit.pathNavigationOptions; if (this.arrivalDistance > _pathSettings.nextNodeDistance) { Debug.LogError("The Arrival Distance must be equal to or less that the Next Node Distance."); } _stopped = true; _unit.hasArrivedAtDestination = true; }