public void CloneFrom(SteerableUnitComponent steerableUnit) { this.groundStickynessFactor = steerableUnit.groundStickynessFactor; this.stopIfStuckForSeconds = steerableUnit.stopIfStuckForSeconds; this.stopTimeFrame = steerableUnit.stopTimeFrame; this.gravity = steerableUnit.gravity; this.terminalVelocity = steerableUnit.terminalVelocity; }
/// <summary> /// Clones from the other component. /// </summary> /// <param name="steerableUnit">The component to clone from.</param> public void CloneFrom(SteerableUnitComponent steerableUnit) { this.stopIfStuckForSeconds = steerableUnit.stopIfStuckForSeconds; this.stopTimeFrame = steerableUnit.stopTimeFrame; }
void Start () { #if (UNITY_EDITOR) if(!EditorApplication.isPlaying) { } else { #endif var go = this.gameObject; ApexComponentMaster master; Rigidbody rb; //Add the required components /* go.AddIfMissing<Rigidbody>(go, false, out rb); bool toggleAll = go.AddIfMissing<ApexComponentMaster>(false, out master); go.AddIfMissing<HumanoidSpeedComponent>(false); go.AddIfMissing<UnitComponent>(false); go.AddIfMissing<SteerableUnitComponent>(go, false); go.AddIfMissing<DefaultHeightNavigator>(go, false); go.AddIfMissing<PathOptionsComponent>(go, false); go.AddIfMissing<SteerToAlignWithVelocity>(go, false); go.AddIfMissing<SteerForPathComponent>(go, 5); go.AddIfMissing<PathVisualizer>(go, false); */ Rigidbody r; this.gameObject.AddIfMissing<Rigidbody>(out r); ApexComponentMaster apexM; HumanoidSpeedComponent hsc; PathOptionsComponent poc; UnitComponent uni; SteerToAlignWithVelocity steer; SteerForPathComponent sfp; WanderBehaviour wand; DefaultHeightNavigator dfn; SteerableUnitComponent suc; SpeedComponent sc; this.gameObject.AddIfMissing<ApexComponentMaster>(out apexM); this.gameObject.AddIfMissing<HumanoidSpeedComponent>(out hsc); this.gameObject.AddIfMissing<UnitComponent>(out uni); this.gameObject.AddIfMissing<SteerForPathComponent>(out sfp); this.gameObject.AddIfMissing<SteerableUnitComponent>(out suc); this.gameObject.AddIfMissing<DefaultHeightNavigator>(out dfn); this.gameObject.AddIfMissing<PathOptionsComponent>(out poc); this.gameObject.AddIfMissing<SteerToAlignWithVelocity>(out steer); this.gameObject.AddIfMissing<SpeedComponent>(out sc); apexMain = this.GetComponent<IMovingObject> (); if(apexMain==null) { apexMain = gameObject.AddComponent<SteerableUnitComponent>(); } apexM.ToggleAll(); unit = this.GetUnitFacade (true); this.gameObject.AddIfMissing<WanderBehaviour>(out wand); anim = this.GetComponentInChildren<Animator> (); steerable = (SteerableUnitComponent) apexMain; suc.enabled = true; sc.enabled = true; uni.enabled = true; poc.enabled = true; dfn.enabled = true; sfp.enabled = true; steer.enabled = true; apexM.enabled = true; BattleMonster m = this.GetComponentInChildren<BattleMonster> (); if (m != null) { Destroy (m); } #if (UNITY_EDITOR) } #endif player = GameObject.FindGameObjectWithTag ("Player"); wander = GetComponent<WanderBehaviour> (); StartCoroutine(toggleOnOffRootMotion()); }