/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.ForceMovement lEffect = lActorCore.GetActiveEffectFromName <LifeCores.ForceMovement>(EffectName); if (lEffect != null) { lEffect.Age = 0f; } else { lEffect = LifeCores.ForceMovement.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.Movement = Movement; lEffect.ReduceMovementOverTime = ReduceMovementOverTime; lEffect.Activate(0f, MaxAge); lActorCore.Effects.Add(lEffect); } } }
/// <summary> /// Initialize the reactor /// </summary> public override void Awake() { if (mOwner != null) { mActorCore = mOwner.GetComponent <ActorCore>(); } }
/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (ActorCore)target; mTargetSO = new SerializedObject(target); // Update the effects so they can update with the definitions. if (!UnityEngine.Application.isPlaying) { mTarget.InstantiateEffects(); } // Generate the list of motions to display Assembly lAssembly = Assembly.GetAssembly(typeof(ActorCoreEffect)); Type[] lMotionTypes = lAssembly.GetTypes().OrderBy(x => x.Name).ToArray <Type>(); for (int i = 0; i < lMotionTypes.Length; i++) { Type lType = lMotionTypes[i]; if (lType.IsAbstract) { continue; } if (typeof(ActorCoreEffect).IsAssignableFrom(lType)) { mEffectTypes.Add(lType); mEffectNames.Add(GetFriendlyName(lType)); } } // Create the list of items to display InstantiateEffectList(); }
/// <summary> /// Called when the inspector needs to draw /// </summary> public override bool OnInspectorGUI(UnityEditor.SerializedObject rTargetSO, UnityEngine.Object rTarget) { bool lIsDirty = base.OnInspectorGUI(rTargetSO, rTarget); if (mActorCore == null && mOwner != null) { mActorCore = mOwner.GetComponent <ActorCore>(); } if (_StoredUnityEventIndex < 0) { lIsDirty = true; _StoredUnityEventIndex = mActorCore.StoreUnityEvent(-1, new ReactorActionEvent()); } //EditorGUILayout.LabelField(_StoredUnityEventIndex.ToString() + " of " + mActorCore._StoredUnityEvents.Count); SerializedProperty lArray = rTargetSO.FindProperty("_StoredUnityEvents"); if (lArray.isArray && lArray.arraySize > _StoredUnityEventIndex) { SerializedProperty lItem = lArray.GetArrayElementAtIndex(_StoredUnityEventIndex); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(lItem); if (EditorGUI.EndChangeCheck()) { lIsDirty = true; } } return(lIsDirty); }
/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.ModifyAttribute lEffect = lActorCore.GetActiveEffectFromSourceID <LifeCores.ModifyAttribute>(mNode.ID); if (lEffect != null) { lEffect.Age = 0f; } else { AttributeMessage lMessage = AttributeMessage.Allocate(); lMessage.AttributeID = AttributeID; lMessage.MinAttributeID = MinAttributeID; lMessage.MaxAttributeID = MaxAttributeID; lMessage.Value = UnityEngine.Random.Range(MinValue, MaxValue); lEffect = LifeCores.ModifyAttribute.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.ResetOnDeactivate = ResetOnDeactivate; lEffect.Activate(TriggerDelay, MaxAge, lMessage); lActorCore.Effects.Add(lEffect); } } }
/// <summary> /// Initialize the reactor /// </summary> public override void Awake() { if (mOwner != null) { mActorCore = mOwner.GetComponent <ActorCore>(); mMotionController = mOwner.GetComponent <MotionController>(); } }
/// <summary> /// Create and configure the ActorCore using the specified Default Form. The Current Form is set to the /// value of the Default Form /// </summary> /// <param name="rMotionController"></param> /// <param name="rDefaultForm"></param> public static ActorCore CreateActorCore(MotionController rMotionController, int rDefaultForm) { ActorCore lCore = CreateActorCore(rMotionController); // Overwrite any initial Form values lCore.SetStateValue(ActorCore.DefaultStates.DefaultForm, rDefaultForm); lCore.SetStateValue(ActorCore.DefaultStates.CurrentForm, rDefaultForm); return(lCore); }
/// <summary> /// Notifies the defender that they are attacked. /// </summary> /// <param name="rRound"></param> public virtual void OnAttacked(CombatMessage rMessage) { //com.ootii.Utilities.Debug.Log.FileWrite(_Transform.name + ".OnAttacked()"); if (Attacked != null) { Attacked(this, rMessage); } if (rMessage.ID != CombatMessage.MSG_DEFENDER_ATTACKED) { return; } ActorCore lDefenderCore = gameObject.GetComponent <ActorCore>(); if (lDefenderCore != null) { lDefenderCore.SendMessage(rMessage); } else { // Check if this defender is blocking, parrying, etc if (mMotionController != null) { mMotionController.SendMessage(rMessage); } // Determine if we're continuing with the attack and apply damage if (rMessage.ID == CombatMessage.MSG_DEFENDER_ATTACKED) { IDamageable lDamageable = gameObject.GetComponent <IDamageable>(); if (lDamageable != null) { lDamageable.OnDamaged(rMessage); } else { rMessage.ID = CombatMessage.MSG_DEFENDER_DAMAGED; if (mMotionController != null) { mMotionController.SendMessage(rMessage); } } } // Disable this combatant if (rMessage.ID == CombatMessage.MSG_DEFENDER_KILLED) { this.enabled = false; } } }
/// <summary> /// Initialize the proxy if one doesn't exist /// </summary> public override void Awake() { if (mOwner != null) { mActorCore = mOwner.GetComponent <ActorCore>(); } if (_StoredUnityEventIndex < 0) { _StoredUnityEventIndex = mActorCore.StoreUnityEvent(-1, new ReactorActionEvent()); } }
/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void DeactivateEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.ActorCoreEffect lEffect = lActorCore.GetActiveEffectFromName(EffectName); if (lEffect != null) { lEffect.Deactivate(); } } }
/// <summary> /// Initializes the MonoBehaviour /// </summary> private void Awake() { mActorCore = gameObject.GetComponent <ActorCore>(); mActorCore.SetStateValue("State", 0); mMotionController = gameObject.GetComponent <MotionController>(); mInventory = gameObject.GetComponent <BasicInventory>(); if (_Target != null) { Target = _Target; } }
/// <summary> /// Create and configure the ActorCore without changing the Default Form /// </summary> /// <param name="rMotionController"></param> public static ActorCore CreateActorCore(MotionController rMotionController) { ActorCore lCore = rMotionController.GetOrAddComponent <ActorCore>(); lCore.SetInitialStateValue(ActorCore.DefaultStates.Stance, 0); lCore.SetInitialStateValue(ActorCore.DefaultStates.DefaultForm, 0); lCore.SetInitialStateValue(ActorCore.DefaultStates.CurrentForm, 0); lCore.GetOrAddReactor <BasicAttackedReactor>(); lCore.GetOrAddReactor <BasicDamagedReactor>(); lCore.GetOrAddReactor <BasicKilledReactor>(); lCore.IsAlive = true; return(lCore); }
public AgentSetUseTransform(GameObject rOwner) : base(rOwner) { _ActivationType = 0; if (mActorCore == null) { mActorCore = rOwner.GetComponent <ActorCore>(); } if (mActorController == null) { mActorController = rOwner.GetComponent <ActorController>(); } if (mNavMeshAgent == null) { mNavMeshAgent = rOwner.GetComponent <NavMeshAgent>(); } }
void SendDeath() { GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } mActorCore = go.GetComponent <ActorCore>(); if (mActorCore != null) { DamageMessage lDamage = DamageMessage.Allocate(); mActorCore.OnKilled(lDamage); lDamage.Release(); } }
public override void Awake() { if (mOwner != null) { if (mActorCore == null) { mActorCore = mOwner.GetComponent <ActorCore>(); } if (mActorController == null) { mActorController = mOwner.GetComponent <ActorController>(); } if (mNavMeshAgent == null) { mNavMeshAgent = mOwner.GetComponent <NavMeshAgent>(); } mInitialUseTransform = mActorController.UseTransformPosition; } }
/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.SpawnParticles lEffect = lActorCore.GetActiveEffectFromSourceID <LifeCores.SpawnParticles>(mNode.ID); if (lEffect != null) { lEffect.Age = 0f; } else { lEffect = LifeCores.SpawnParticles.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.Activate(MaxAge, Prefab); lActorCore.Effects.Add(lEffect); } } }
/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.CauseDamage lEffect = lActorCore.GetActiveEffectFromSourceID <LifeCores.CauseDamage>(mNode.ID); if (lEffect != null) { lEffect.Age = 0f; } else { // Determine the damage float lDamage = UnityEngine.Random.Range(_MinDamage, _MaxDamage); if (_DamageFloatValueIndex >= 0 && _Spell.Data.FloatValues != null) { lDamage = _Spell.Data.FloatValues[_DamageFloatValueIndex]; } // Setup the message DamageMessage lMessage = DamageMessage.Allocate(); lMessage.DamageType = DamageType; lMessage.ImpactType = ImpactType; lMessage.Damage = lDamage; lMessage.AnimationEnabled = PlayAnimation; lEffect = LifeCores.CauseDamage.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.Activate(TriggerDelay, MaxAge, lMessage); lActorCore.Effects.Add(lEffect); } } }
/// <summary> /// Adds an effect to the game object /// </summary> /// <param name="rObject">GameObject to add the effect to</param> protected void AddEffect(GameObject rTarget) { ActorCore lActorCore = rTarget.GetComponent <ActorCore>(); if (lActorCore != null) { LifeCores.ModifyMovement lEffect = lActorCore.GetActiveEffectFromName <LifeCores.ModifyMovement>(EffectName); if (lEffect != null) { lEffect.Age = 0f; } else { lEffect = LifeCores.ModifyMovement.Allocate(); lEffect.Name = EffectName; lEffect.SourceID = mNode.ID; lEffect.ActorCore = lActorCore; lEffect.MovementFactor = UnityEngine.Random.Range(MinValue, MaxValue); lEffect.Activate(0f, MaxAge); lActorCore.Effects.Add(lEffect); } } }
/// <summary> /// Update is called every frame, if the MonoBehaviour is enabled. /// </summary> protected virtual void Update() { if (mMotionController == null) { return; } if (mInputSource != null) { if (_IsLockingEnabled && _ToggleCombatantLockAlias.Length > 0) { if (mInputSource.IsJustPressed(_ToggleCombatantLockAlias)) { if (IsTargetLocked) { Target = null; } else { if (mActorStances == null || mActorStances.Count == 0 || mActorStances.Contains(mMotionController.Stance)) { Target = FindTarget(); } } } } } // Unlock the target if our stance isn't valid if (_IsLockingEnabled && IsTargetLocked) { // Ensure our target is alive and able to be targeted if (_Target != null) { ActorCore lTargetActorCore = _Target.GetComponent <ActorCore>(); if (lTargetActorCore != null && !lTargetActorCore.IsAlive) { IsTargetLocked = false; OnTargetUnlocked(_Target); } } // Ensure we're in a stance where targeting is valid if (mActorStances != null && mActorStances.Count > 0 && !mActorStances.Contains(mMotionController.Stance)) { IsTargetLocked = false; OnTargetUnlocked(_Target); } // Finally, force the rotations as needed if (IsTargetLocked) { if (_ForceActorRotation) { RotateActorToTarget(_Target, 360f); } if (_ForceCameraRotation && mMotionController.CameraRig == null) { RotateCameraToTarget(_Target, 360f); } } } }
/// <summary> /// ActorCore constructor /// </summary> public UnityEventProxy(GameObject rOwner) : base(rOwner) { mActorCore = rOwner.GetComponent <ActorCore>(); }
public NeoFPSDamagedReactor(GameObject rOwner) : base(rOwner) { _ActivationType = 0; mActorCore = rOwner.GetComponent <ActorCore>(); }
/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (ActorCore)target; mTargetSO = new SerializedObject(target); // Update the effects so they can update with the definitions. if (!UnityEngine.Application.isPlaying) { mTarget.InstantiateStates(); mTarget.InstantiateReactors(); mTarget.InstantiateEffects(); } // Create the list of items to display InstantiateStateList(); // CDL 06 / 28 / 2018 - this only scans the assembly containing ReactorAction //// Generate the list to display //Assembly lReactorAssembly = Assembly.GetAssembly(typeof(ReactorAction)); //Type[] lReactorTypes = lReactorAssembly.GetTypes().OrderBy(x => x.Name).ToArray<Type>(); //for (int i = 0; i < lReactorTypes.Length; i++) //{ // Type lType = lReactorTypes[i]; // if (lType.IsAbstract) { continue; } // if (typeof(ReactorAction).IsAssignableFrom(lType)) // { // mReactorTypes.Add(lType); // mReactorNames.Add(BaseNameAttribute.GetName(lType)); // } //} // CDL 06 / 28 / 2018 - scan all assemblies for Reactors and Actor Core Effects List <Type> lFoundTypes = AssemblyHelper.FoundTypes; for (int i = 0; i < lFoundTypes.Count; i++) { Type lType = lFoundTypes[i]; if (lType.IsAbstract) { continue; } if (typeof(ReactorAction).IsAssignableFrom(lType)) { mReactorTypes.Add(lType); mReactorNames.Add(BaseNameAttribute.GetName(lType)); } else if (typeof(ActorCoreEffect).IsAssignableFrom(lType)) { mEffectTypes.Add(lType); mEffectNames.Add(BaseNameAttribute.GetName(lType)); } } // Create the list of items to display InstantiateReactorList(); // CDL 06 / 28 / 2018 - this only scans the assembly containing ActorCoreEffect //// Generate the list to display //Assembly lEffectAssembly = Assembly.GetAssembly(typeof(ActorCoreEffect)); //Type[] lEffectTypes = lEffectAssembly.GetTypes().OrderBy(x => x.Name).ToArray<Type>(); //for (int i = 0; i < lEffectTypes.Length; i++) //{ // Type lType = lEffectTypes[i]; // if (lType.IsAbstract) { continue; } // if (typeof(ActorCoreEffect).IsAssignableFrom(lType)) // { // mEffectTypes.Add(lType); // mEffectNames.Add(BaseNameAttribute.GetName(lType)); // } //} // Create the list of items to display InstantiateEffectList(); }
/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (ActorCore)target; mTargetSO = new SerializedObject(target); }
/// <summary> /// Raised when the impact occurs /// </summary> /// <param name="rHitInfo">CombatHit structure detailing the hit information.</param> /// <param name="rAttackStyle">ICombatStyle that details the combat style being used.</param> protected override void OnImpact(CombatHit rHitInfo, ICombatStyle rAttackStyle = null) { // Test impact is now rolling up to the parent object but this means we are trying to apply the damage to the actorcore rather than the collider actually hit // see Test impact below IHealthManager lHealthManager = rHitInfo.Collider.gameObject.GetComponentInParent <IHealthManager>(); GameObject defender = ((MonoBehaviour)lHealthManager).gameObject; mDefenders.Add(defender); mImpactCount++; Transform lHitTransform = GetClosestTransform(rHitInfo.Point, rHitInfo.Collider.transform); Vector3 lHitDirection = Quaternion.Inverse(lHitTransform.rotation) * (rHitInfo.Point - lHitTransform.position).normalized; CombatMessage lMessage = CombatMessage.Allocate(); lMessage.Attacker = mOwner; lMessage.Defender = rHitInfo.Collider.gameObject; lMessage.Weapon = this; lMessage.Damage = GetAttackDamage(Random.value, (rAttackStyle != null ? rAttackStyle.DamageModifier : 1f)); lMessage.ImpactPower = GetAttackImpactPower(); lMessage.HitPoint = rHitInfo.Point; lMessage.HitDirection = lHitDirection; lMessage.HitVector = rHitInfo.Vector; lMessage.HitTransform = lHitTransform; lMessage.AttackIndex = mAttackStyleIndex; lMessage.CombatStyle = rAttackStyle; ActorCore lAttackerCore = (mOwner != null ? mOwner.GetComponentInParent <ActorCore>() : null); ActorCore lDefenderCore = defender.gameObject.GetComponentInParent <ActorCore>(); lMessage.ID = CombatMessage.MSG_ATTACKER_ATTACKED; if (lAttackerCore != null) { lAttackerCore.SendMessage(lMessage); } #if USE_MESSAGE_DISPATCHER || OOTII_MD MessageDispatcher.SendMessage(lMessage); #endif lMessage.ID = CombatMessage.MSG_DEFENDER_ATTACKED; if (lDefenderCore != null) { lDefenderCore.SendMessage(lMessage); #if USE_MESSAGE_DISPATCHER || OOTII_MD MessageDispatcher.SendMessage(lMessage); #endif } if (lAttackerCore != null) { lAttackerCore.SendMessage(lMessage); #if USE_MESSAGE_DISPATCHER || OOTII_MD MessageDispatcher.SendMessage(lMessage); #endif } OnImpactComplete(lMessage); CombatMessage.Release(lMessage); }
public BasicHandPoseReactor(GameObject rOwner) : base(rOwner) { _ActivationType = 0; mActorCore = rOwner.GetComponent <ActorCore>(); mMotionController = rOwner.GetComponent <MotionController>(); }
/// <summary> /// Draws the inspector for the pack /// </summary> /// <returns></returns> public static bool OnPackInspector(MotionController rMotionController) { EditorHelper.DrawSmallTitle(GroupName()); EditorHelper.DrawLink("Mixamo Pro Magic Pack Animations", "http://www.ootii.com/Unity/MotionPacks/SpellCasting/SpellCastingUsersGuide.pdf"); GUILayout.Space(5f); EditorGUILayout.LabelField("See included documentation:", EditorHelper.SmallBoldLabel); EditorGUILayout.LabelField("1. Download and import animations.", EditorHelper.SmallLabel); EditorGUILayout.LabelField("2. Unzip and replace animation meta files.", EditorHelper.SmallLabel); EditorGUILayout.LabelField("3. Select options and create motions.", EditorHelper.SmallLabel); EditorHelper.DrawLine(); EditorHelper.BoolField("Create Mecanim States", "Determines if we create/override the existing sub-state machine", sCreateSubStateMachines); sCreateSubStateMachines = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Input Aliases", "Determines if we create input aliases", sCreateInputAliases); sCreateInputAliases = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Inventory", "Determines if we create/override the existing inventory", sCreateInventory); sCreateInventory = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Attributes", "Determines if we create/override the existing attributes", sCreateAttributes); sCreateAttributes = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Spell Inventory", "Create the spell inventory for the caster", sCreateSpellInventory); sCreateSpellInventory = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Combatant", "Determines if we create/override the existing core", sCreateCore); sCreateCore = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Motions", "Determines if we create the archery motions", sCreateMotions); sCreateMotions = EditorHelper.FieldBoolValue; GUILayout.Space(5f); if (GUILayout.Button(new GUIContent("Setup Pack", "Create and setup the motion pack."), EditorStyles.miniButton)) { if (sCreateInventory) { BasicInventory lInventory = rMotionController.gameObject.GetComponent <BasicInventory>(); if (lInventory == null) { lInventory = rMotionController.gameObject.AddComponent <BasicInventory>(); } BasicInventoryItem lItem = lInventory.GetInventoryItem("Spell_01"); if (lItem != null) { lInventory.Items.Remove(lItem); } lInventory.Items.Add(new BasicInventoryItem()); lInventory.Items[lInventory.Items.Count - 1].ID = "Spell_01"; lInventory.Items[lInventory.Items.Count - 1].EquipMotion = "PMP_EquipSpell"; lInventory.Items[lInventory.Items.Count - 1].StoreMotion = "PMP_StoreSpell"; BasicInventorySlot lSlot = lInventory.GetInventorySlot("RIGHT_HAND"); if (lSlot == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "RIGHT_HAND"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } if (lInventory.GetInventorySlot("LEFT_HAND") == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "LEFT_HAND"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } lSlot = lInventory.GetInventorySlot("LEFT_LOWER_ARM"); if (lSlot == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "LEFT_LOWER_ARM"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } if (lInventory.GetInventorySlot("READY_PROJECTILE") == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "READY_PROJECTILE"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } BasicInventorySet lWeaponSet = lInventory.GetWeaponSet("Spell Casting"); if (lWeaponSet != null) { lInventory.WeaponSets.Remove(lWeaponSet); } lWeaponSet = new BasicInventorySet(); lWeaponSet.ID = "Spell Casting"; BasicInventorySetItem lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "LEFT_HAND"; lWeaponSetItem.Instantiate = true; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "READY_PROJECTILE"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = "Spell_01"; lWeaponSetItem.SlotID = "RIGHT_HAND"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "LEFT_LOWER_ARM"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); if (lInventory.WeaponSets.Count == 0) { BasicInventorySet lFirstWeaponSet = new BasicInventorySet(); lFirstWeaponSet.ID = "Sword and Shield"; lInventory.WeaponSets.Add(lFirstWeaponSet); } if (lInventory.WeaponSets.Count == 1) { BasicInventorySet lSecondWeaponSet = new BasicInventorySet(); lSecondWeaponSet.ID = "Longbow"; lInventory.WeaponSets.Add(lSecondWeaponSet); } lInventory.WeaponSets.Insert(2, lWeaponSet); } if (sCreateAttributes) { BasicAttributes lAttributes = rMotionController.gameObject.GetComponent <BasicAttributes>(); if (lAttributes == null) { lAttributes = rMotionController.gameObject.AddComponent <BasicAttributes>(); } BasicAttribute lAttribute = lAttributes.GetAttribute("Health"); if (lAttribute != null) { lAttributes.Items.Remove(lAttribute); } lAttributes.Items.Add(new BasicAttribute()); lAttributes.Items[lAttributes.Items.Count - 1].ID = "Health"; lAttributes.Items[lAttributes.Items.Count - 1].SetValue <float>(100f); } if (sCreateSpellInventory) { SpellInventory lAttributes = rMotionController.gameObject.GetComponent <SpellInventory>(); if (lAttributes == null) { lAttributes = rMotionController.gameObject.AddComponent <SpellInventory>(); } } if (sCreateCore) { Combatant lCombatant = rMotionController.gameObject.GetComponent <Combatant>(); if (lCombatant == null) { lCombatant = rMotionController.gameObject.AddComponent <Combatant>(); } if (rMotionController._ActorController == null || !rMotionController._ActorController.UseTransformPosition) { lCombatant.IsLockingEnabled = true; lCombatant.TargetLockedIcon = AssetDatabase.LoadAssetAtPath <Texture>("Assets/ootii/Framework_v1/Content/Textures/UI/TargetIcon_2.png"); } ActorCore lCore = rMotionController.gameObject.GetComponent <ActorCore>(); if (lCore == null) { lCore = rMotionController.gameObject.AddComponent <ActorCore>(); } lCore.IsAlive = true; } if (sCreateInputAliases) { // Sheathe if (!InputManagerHelper.IsDefined("Spell Casting Equip")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Equip"; lEntry.PositiveButton = "3"; // "3" key lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Equip"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.JoyNum = 0; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 8"; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; // D-pad Y lEntry.Axis = 0; #else lEntry.PositiveButton = ""; lEntry.Type = InputManagerEntryType.JOYSTICK_AXIS; // D-pad Y lEntry.Axis = 7; #endif InputManagerHelper.AddEntry(lEntry, true); } // Fire if (!InputManagerHelper.IsDefined("Spell Casting Cast")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cast"; lEntry.PositiveButton = "left ctrl"; lEntry.AltPositiveButton = "mouse 0"; // Left mouse button lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cast"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 16"; // Green A #else lEntry.PositiveButton = "joystick button 0"; // Green A #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Continue if (!InputManagerHelper.IsDefined("Spell Casting Continue")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Continue"; lEntry.PositiveButton = "left ctrl"; lEntry.AltPositiveButton = "mouse 0"; // Left mouse button lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Continue"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 16"; // Green A #else lEntry.PositiveButton = "joystick button 0"; // Green A #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Cancel if (!InputManagerHelper.IsDefined("Spell Casting Cancel")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cancel"; lEntry.PositiveButton = "escape"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cancel"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 19"; // Yellow Y #else lEntry.PositiveButton = "joystick button 3"; // Yellow Y #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Move Up if (!InputManagerHelper.IsDefined("Move Up")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Move Up"; lEntry.PositiveButton = "e"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Move down if (!InputManagerHelper.IsDefined("Move Down")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Move Down"; lEntry.PositiveButton = "q"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } } if (sCreateMotions || sCreateSubStateMachines) { IBaseCameraRig lCameraRig = rMotionController.CameraRig; if (lCameraRig == null) { lCameraRig = rMotionController.ExtractCameraRig(rMotionController.CameraTransform); } if (rMotionController.MotionLayers.Count == 0) { MotionControllerLayer lMotionLayer = new MotionControllerLayer(); rMotionController.MotionLayers.Add(lMotionLayer); } PMP_Idle lIdle = rMotionController.GetMotion <PMP_Idle>(); if (lIdle == null) { lIdle = rMotionController.CreateMotion <PMP_Idle>(0); } PMP_EquipSpell lEquip = rMotionController.GetMotion <PMP_EquipSpell>(0); if (lEquip == null) { lEquip = rMotionController.CreateMotion <PMP_EquipSpell>(0); } PMP_StoreSpell lStore = rMotionController.GetMotion <PMP_StoreSpell>(0); if (lStore == null) { lStore = rMotionController.CreateMotion <PMP_StoreSpell>(0); } PMP_WalkRunPivot lPivot = rMotionController.GetMotion <PMP_WalkRunPivot>(0); if (lPivot == null) { lPivot = rMotionController.CreateMotion <PMP_WalkRunPivot>(0); } PMP_WalkRunStrafe lStrafe = rMotionController.GetMotion <PMP_WalkRunStrafe>(0); if (lStrafe == null) { lStrafe = rMotionController.CreateMotion <PMP_WalkRunStrafe>(0); } PMP_BasicSpellCastings lCast = rMotionController.GetMotion <PMP_BasicSpellCastings>(0); if (lCast == null) { lCast = rMotionController.CreateMotion <PMP_BasicSpellCastings>(0); } Cower lCower = rMotionController.GetMotion <Cower>(0); if (lCower == null) { lCower = rMotionController.CreateMotion <Cower>(0); } Death lDeath = rMotionController.GetMotion <Death>(0); if (lDeath == null) { lDeath = rMotionController.CreateMotion <Death>(0); } Damaged lDamaged = rMotionController.GetMotion <Damaged>(0); if (lDamaged == null) { lDamaged = rMotionController.CreateMotion <Damaged>(0); } Frozen lFrozen = rMotionController.GetMotion <Frozen>(0); if (lFrozen == null) { lFrozen = rMotionController.CreateMotion <Frozen>(0); } KnockedDown lKnockedDown = rMotionController.GetMotion <KnockedDown>(0); if (lKnockedDown == null) { lKnockedDown = rMotionController.CreateMotion <KnockedDown>(0); } Levitate lLevitate = rMotionController.GetMotion <Levitate>(0); if (lLevitate == null) { lLevitate = rMotionController.CreateMotion <Levitate>(0); } PushedBack lPushedBack = rMotionController.GetMotion <PushedBack>(0); if (lPushedBack == null) { lPushedBack = rMotionController.CreateMotion <PushedBack>(0); } Sleep lSleep = rMotionController.GetMotion <Sleep>(0); if (lSleep == null) { lSleep = rMotionController.CreateMotion <Sleep>(0); } Stunned lStunned = rMotionController.GetMotion <Stunned>(0); if (lStunned == null) { lStunned = rMotionController.CreateMotion <Stunned>(0); } if (sCreateSubStateMachines) { Animator lAnimator = rMotionController.Animator; if (lAnimator == null) { lAnimator = rMotionController.gameObject.GetComponent <Animator>(); } if (lAnimator != null) { UnityEditor.Animations.AnimatorController lAnimatorController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController; lIdle.CreateStateMachine(lAnimatorController); lEquip.CreateStateMachine(lAnimatorController); lPivot.CreateStateMachine(lAnimatorController); lStrafe.CreateStateMachine(lAnimatorController); lCast.CreateStateMachine(lAnimatorController); lDeath.CreateStateMachine(lAnimatorController); lLevitate.CreateStateMachine(lAnimatorController); } } } EditorUtility.DisplayDialog("Motion Pack: " + GroupName(), "Motion pack imported.", "ok"); return(true); } return(false); }
/// <summary> /// ActorCore constructor /// </summary> public BasicAttackedReactor(GameObject rOwner) : base(rOwner) { _ActivationType = 0; mActorCore = rOwner.GetComponent <ActorCore>(); }