Ejemplo n.º 1
0
        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;
        }