public static GameObject BuildComputerControlledEntity( Game1 game, int playerNumber, Color playerColor, Vector2 position, float rotation, Vector2 scale, float maxGroundSpeed, float maxAirSpeed, SpriteType spriteType, List<Shape> boundingBoxes, Dictionary<ActionDefinition, ActionInfo> actionsInformationList, GameObject opponent) { GameObject entity = DynamicEntityFactory.BuildCharacterEntity( game, playerNumber, playerColor, position, rotation, scale, maxGroundSpeed, maxAirSpeed, spriteType, boundingBoxes, actionsInformationList ); AIControllerComponent aiComponent = new AIControllerComponent(entity); AStarComponent aStarComponent = new AStarComponent(entity); BehaviourComponent behaviourComponent = new BehaviourComponent( entity, BehaviourFactory.Easy( game, entity, opponent )); SoundComponent soundComponent = new SoundComponent(entity); entity.AddComponent(aiComponent); entity.AddComponent(aStarComponent); entity.AddComponent(behaviourComponent); return entity; }
private void playSounds(int act, int voice, SoundComponent sound) { if (act != 0) { if (act == 8) { sound.actionSoundList[0].Play(); } else if (act == 9) { sound.actionSoundList[1].Play(); } else if (act == 14) { sound.actionSoundList[2].Play(); } else if (act == 16) { sound.actionSoundList[3].Play(); } else if (act == 22) { sound.actionSoundList[4].Play(); } else if (act == 28) { sound.actionSoundList[5].Play(); } else if (act == 31) { sound.actionSoundList[7].Play(); } else if (act == 32) { sound.actionSoundList[8].Play(); } else if (act == 33) { sound.actionSoundList[9].Play(); } else if (act == 36) { sound.actionSoundList[10].Play(); } else if (act == 37) { sound.actionSoundList[11].Play(); } else if (act == 39) { sound.actionSoundList[12].Play(); } else if (act == 53) { sound.actionSoundList[13].Play(); } else if (act == 109) { sound.actionSoundList[14].Play(); } else if (act == 111) { sound.actionSoundList[15].Play(); } else if (act == 112) { sound.actionSoundList[16].Play(); } else if (act == 116) { sound.actionSoundList[17].Play(); } else if (act == 122) { sound.actionSoundList[18].Play(); } else if (act == 123) { sound.actionSoundList[19].Play(); } } if (voice != 0) { if (voice == 34) { sound.voiceSoundList[0].Play(); } else if (voice == 36) { sound.voiceSoundList[1].Play(); } else if (voice == 38) { sound.voiceSoundList[2].Play(); } else if (voice == 42) { sound.voiceSoundList[3].Play(); } else if (voice == 43) { sound.voiceSoundList[4].Play(); } else if (voice == 49) { sound.voiceSoundList[5].Play(); } else if (voice == 50) { sound.voiceSoundList[6].Play(); } else if (voice == 51) { sound.voiceSoundList[7].Play(); } else if (voice == 118) { sound.voiceSoundList[8].Play(); } } }
public static GameObject BuildDynamicEntity( Game1 game, Vector2 position, float rotation, Vector2 scale, float maxGroundSpeed, float maxAirSpeed, SpriteType spriteType, List<Shape> boundingBoxes) { GameObject entity = new GameObject(game); Transform2DComponent transformComponent = new Transform2DComponent( entity, position, rotation, scale); SpriteComponent sprite = new SpriteComponent(entity, spriteType, game); BoundingBoxComponent bbComponent = new BoundingBoxComponent(entity, boundingBoxes, true); CurrentActionComponent caComponent = new CurrentActionComponent( entity, new ActionComponent(DirectionalAction.Left, SecondaryAction.Stand, PrimaryAction.None), new Dictionary<ActionDefinition, ActionInfo>()); GravityComponent gravComponent = new GravityComponent(entity, 1.0f); MotionPropertiesComponent motionComponent = new MotionPropertiesComponent( entity, 1.0f, maxGroundSpeed, maxAirSpeed); IsPhysicalComponent isPhysicalComponent = new IsPhysicalComponent(entity, true); IsCharacterComponent isCharComponent = new IsCharacterComponent(entity); SoundComponent soundComponent = new SoundComponent(entity); entity.AddComponent(transformComponent); entity.AddComponent(sprite); entity.AddComponent(bbComponent); entity.AddComponent(caComponent); entity.AddComponent(gravComponent); entity.AddComponent(motionComponent); entity.AddComponent(isPhysicalComponent); entity.AddComponent(isCharComponent); entity.AddComponent(soundComponent); return entity; }