public void CloneFrom(IDefineSpeed speedComponent) { var c = speedComponent as OneSpeed; if (c != null) { this.speed = c.speed; } }
public override void CloneFrom(IDefineSpeed speedComponent) { base.CloneFrom(speedComponent); var gs = speedComponent as GenericSpeedComponent; if (gs != null) { this.defaultSpeed = gs.defaultSpeed; } }
/// <summary> /// Clones from the other component. /// </summary> /// <param name="speedComponent">The component to clone from</param> public override void CloneFrom(IDefineSpeed speedComponent) { base.CloneFrom(speedComponent); var hs = speedComponent as CarSpeedComponent; if (hs != null) { this.sidewaysSpeedFactor = hs.sidewaysSpeedFactor; this.reverseMaxSpeed = hs.reverseMaxSpeed; } }
public override void CloneFrom(IDefineSpeed speedComponent) { base.CloneFrom(speedComponent); var hs = speedComponent as HumanoidSpeedComponent; if (hs != null) { this.crawlSpeed = hs.crawlSpeed; this.crouchedSpeed = hs.crouchedSpeed; this.walkSpeed = hs.walkSpeed; this.runSpeed = hs.runSpeed; this.strafeMaxSpeed = hs.strafeMaxSpeed; this.backPedalMaxSpeed = hs.backPedalMaxSpeed; } }
/// <summary> /// Clones from the other component. /// </summary> /// <param name="speedComponent">The component to clone from</param> public override void CloneFrom(IDefineSpeed speedComponent) { base.CloneFrom(speedComponent); var hs = speedComponent as HumanoidSpeedComponent; if (hs != null) { this.crawlSpeed = hs.crawlSpeed; this.crouchedSpeed = hs.crouchedSpeed; this.walkSpeed = hs.walkSpeed; this.runSpeed = hs.runSpeed; this.strafeMaxSpeed = hs.strafeMaxSpeed; this.backPedalMaxSpeed = hs.backPedalMaxSpeed; } }
/// <summary> /// Clones settings from another speed component. /// </summary> /// <param name="speedComponent">The speed component to clone from.</param> public virtual void CloneFrom(IDefineSpeed speedComponent) { this.maxAngularAcceleration = speedComponent.maxAngularAcceleration; this.maximumAngularSpeed = speedComponent.maximumAngularSpeed; this.maxAcceleration = speedComponent.maxAcceleration; this.maxDeceleration = speedComponent.maxDeceleration; this.minimumSpeed = speedComponent.minimumSpeed; this.maximumSpeed = speedComponent.maximumSpeed; var sc = speedComponent as SpeedComponent; if (sc != null) { _preferredSpeed = sc._preferredSpeed; } }
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; }
void IDefineSpeed.CloneFrom(IDefineSpeed speedComponent) { _speeder.CloneFrom(speedComponent); }
public void CloneFrom(IDefineSpeed speedComponent) { throw new NotImplementedException(); }
private void Awake() { this.WarnIfMultipleInstances(); _transform = this.transform; _facingOrientation = new FacingOrientation { priority = this.turnRequestPriority, turnSpeed = this.turnSpeed }; //Get the speed source _speedSource = this.As<IDefineSpeed>(); if (_speedSource == null) { Debug.LogError("A speed source component is required to steer."); this.enabled = false; } //Resolve the mover _mover = this.As<IMoveUnits>(); if (_mover == null) { var fact = this.As<IMoveUnitsFactory>(); var charController = this.GetComponent<CharacterController>(); if (fact != null) { _mover = fact.Create(); } else if (charController != null) { _mover = new CharacterControllerMover(charController); } else if (this.rigidbody != null) { _mover = new RigidBodyMover(_transform, this.rigidbody); } else { _mover = new DefaultMover(_transform); } } _unit = this.GetComponent<UnitComponent>(); _steeringComponents = new List<SteeringComponent>(); _minimumSpeedToTurnSquared = this.minimumSpeedToTurn * this.minimumSpeedToTurn; _stopped = true; }