string getPathToAnimatorController(NPC npc) { string path = ""; AggressionState npcAggresstionState = npc.aggressionState; if (npc.name.Equals(SKELETON)) { if (npcAggresstionState.isLook()) { path = SKELETON_FOLDER + "/" + "skeletonLookController"; } else if (npcAggresstionState.isFollow()) { path = SKELETON_FOLDER + "/" + "skeletonFollowController"; } else if (npcAggresstionState.isAttack()) { path = SKELETON_FOLDER + "/" + "skeletonAttackController"; } else { Debug.Log("Could not find animator controller path based on aggression state for Skeleton"); } } return(path); }
void addCorrespondingScript(GameObject npc, NPC npcObject, int roomIndex) { AggressionState npcAggressionState = npcObject.aggressionState; if (npcAggressionState.isLook()) { npc.AddComponent <LookScript> (); } else if (npcAggressionState.isFollow()) { FollowScript follow = npc.AddComponent <FollowScript> (); follow.roomIndex = roomIndex; } else if (npcAggressionState.isAttack()) { AttackScript attack = npc.AddComponent <AttackScript> (); attack.roomIndex = roomIndex; } else { Debug.Log("NPC's current state has no script association"); } }