public void Initialize( AIProperties properties, VelocityBody velBody, Animator animator, Stats stats, NavMeshAgent navAgent, NavMeshObstacle navObstacle, BulletHellPatternController bulletPatternController, List <AIState> aiStates) { this.properties = properties; this.stats = stats; this.animator = animator; this.navAgent = navAgent; this.navObstacle = navObstacle; states = new States(); states.Initialize(properties, this, velBody, animator, stats, navAgent, navObstacle, bulletPatternController, aiStates); if (mod != null) { modMemento.Initialize(mod.transform); } //CurrentState = states.getUp; }
public void Initialize( AIProperties properties, AIController controller, VelocityBody velBody, Animator animator, Stats stats, NavMeshAgent navAgent, NavMeshObstacle navObstacle, BulletHellPatternController bulletPatternController, List <AIState> aiStatesElements) { aiStates = new Dictionary <EAIState, AIState>(); foreach (AIState state in aiStatesElements) { state.Initialize(properties, controller, velBody, animator, stats, navAgent, navObstacle, bulletPatternController); if (state.stateName.Equals("chase")) { chase = state; aiStates.Add(EAIState.Chase, chase); } else if (state.stateName.Equals("attack")) { attack = state; aiStates.Add(EAIState.Attack, attack); } else if (state.stateName.Equals("fire")) { fire = state; aiStates.Add(EAIState.Fire, fire); } else if (state.stateName.Equals("death")) { death = state; aiStates.Add(EAIState.Death, death); } else if (state.stateName.Equals("stun")) { stun = state; aiStates.Add(EAIState.Stun, stun); } else if (state.stateName.Equals("celebrate")) { celebrate = state; aiStates.Add(EAIState.Celebrate, celebrate); } else if (state.stateName.Equals("getUp")) { getUp = state; aiStates.Add(EAIState.GetUp, getUp); } } }
public void Initialize( AIProperties properties, AIController controller, VelocityBody velBody, Animator animator, Stats myStats, NavMeshAgent navAgent, NavMeshObstacle navObstacle) { this.properties = properties; this.controller = controller; this.velBody = velBody; this.animator = animator; this.myStats = myStats; this.navAgent = navAgent; this.navObstacle = navObstacle; }
private static GameObject CreateAI(AIProperties properties) { // Instantiate AI object GameObject ai = GameObject.Instantiate(properties.GetModel(), Vector3.zero, Quaternion.identity); // Set tag and layer ai.name = properties.GetName(); ai.tag = TNC.AI; switch (properties.GetAIType()) { case AIProperties.AIType.AgainstAll: ai.layer = LayerMask.NameToLayer(LNC.AI); break; case AIProperties.AIType.Friendly: ai.layer = LayerMask.NameToLayer(LNC.AI_FRIENDLY); break; case AIProperties.AIType.Enemy: ai.layer = LayerMask.NameToLayer(LNC.AI_ENEMY); break; } // Set components Animator animator = ai.GetComponent <Animator>(); if (animator == null) { animator = ai.AddComponent <Animator>(); } if (properties.GetController() != null) { animator.runtimeAnimatorController = properties.GetController(); } AIController controller = ai.GetComponent <AIController>(); if (controller == null) { controller = ai.AddComponent <AIController>(); } AIHealth health = ai.GetComponent <AIHealth>(); if (health == null) { health = ai.AddComponent <AIHealth>(); } AIFieldOfView fieldOfView = ai.GetComponent <AIFieldOfView>(); if (fieldOfView == null) { fieldOfView = ai.AddComponent <AIFieldOfView>(); } AIAttackSystem attackSystem = ai.GetComponent <AIAttackSystem>(); if (attackSystem == null) { attackSystem = ai.AddComponent <AIAttackSystem>(); } AIReloadSystem reloadSystem = ai.GetComponent <AIReloadSystem>(); if (reloadSystem == null) { reloadSystem = ai.AddComponent <AIReloadSystem>(); } AIAnimatorHandler animatorHandler = ai.GetComponent <AIAnimatorHandler>(); if (animatorHandler == null) { animatorHandler = ai.AddComponent <AIAnimatorHandler>(); } CharacterRagdollSystem ragdollSystem = ai.GetComponent <CharacterRagdollSystem>(); if (ragdollSystem == null) { ragdollSystem = ai.AddComponent <CharacterRagdollSystem>(); } NavMeshAgent navMeshAgent = ai.GetComponent <NavMeshAgent>(); if (navMeshAgent == null) { navMeshAgent = ai.AddComponent <NavMeshAgent>(); } CapsuleCollider capsuleCollider = ai.GetComponent <CapsuleCollider>(); if (capsuleCollider == null) { capsuleCollider = ai.AddComponent <CapsuleCollider>(); } AudioSource audioSource = ai.GetComponent <AudioSource>(); if (audioSource == null) { audioSource = ai.AddComponent <AudioSource>(); } // Set component positions UEditorInternal.MoveComponentBottom <Animator>(ai.transform); UEditorInternal.MoveComponentBottom <AIController>(ai.transform); UEditorInternal.MoveComponentBottom <AIHealth>(ai.transform); UEditorInternal.MoveComponentBottom <AIFieldOfView>(ai.transform); UEditorInternal.MoveComponentBottom <AIAttackSystem>(ai.transform); UEditorInternal.MoveComponentBottom <AIReloadSystem>(ai.transform); UEditorInternal.MoveComponentBottom <AIAnimatorHandler>(ai.transform); UEditorInternal.MoveComponentBottom <CharacterRagdollSystem>(ai.transform); UEditorInternal.MoveComponentBottom <NavMeshAgent>(ai.transform); UEditorInternal.MoveComponentBottom <CapsuleCollider>(ai.transform); UEditorInternal.MoveComponentBottom <AudioSource>(ai.transform); // Set properties settings fieldOfView.SetTargetMask(properties.GetTargets()); fieldOfView.SetObstacleMask(properties.GetObstacles()); return(ai); }
/// <summary> /// This function is called when the object becomes enabled and active. /// </summary> public static void OnEnable() { properties = new AIProperties(); delay = new EditorDelay(0.1f); }