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); }
public NPC selectNPC(RoomObject roomNPCIsIN) { //if there are more than one NPC by the end a random number generator would select which NPC for the given room NPC npc = new NPC(); npc.name = SKELETON; AggressionState state = new AggressionState(); state.initialize(); npc.aggressionState = state; npc.boundary = createBoundary(roomNPCIsIN); return(npc); }
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"); } }