// Parent name (who's anchoring the entity) public static string ParentEntityName(GameEntityModel model){ GameEntityModel parentEntityModel = StateManager.state.GetModel(model.parentEntity) as GameEntityModel; if (parentEntityModel == null) return null; AnimationModel animModel = GameEntityController.GetAnimationModel(parentEntityModel); if (animModel == null) return null; return animModel.characterName; }
// Anchored animation name public static string AnchoredEntityAnimation(GameEntityModel model, int anchorId){ if (model.anchoredEntities == null || model.anchoredEntities.Count <= anchorId || model.anchoredEntities[anchorId] == null) return null; GameEntityModel anchoredEntityModel = StateManager.state.GetModel(model.anchoredEntities[anchorId]) as GameEntityModel; if (anchoredEntityModel == null) return null; AnimationModel animModel = GameEntityController.GetAnimationModel(anchoredEntityModel); if (animModel == null) return null; return animModel.animationName; }
// Forces the animation of an anchored entity, so that it can't be messed with it's current animation events public static void SetAnchoredEntityAnimation(GameEntityModel model, int anchorId, string animationName){ if (model.anchoredEntities == null || model.anchoredEntities.Count <= anchorId) return; GameEntityModel anchoredEntityModel = StateManager.state.GetModel(model.anchoredEntities[anchorId]) as GameEntityModel; if (anchoredEntityModel != null){ AnimationModel anchoredAnimationModel = GameEntityController.GetAnimationModel(anchoredEntityModel); AnimationController anchoredAnimController = anchoredAnimationModel.Controller() as AnimationController; if (anchoredAnimController != null){ // Force animation, so that it ignores any desired transition from a previous animation update anchoredAnimController.ForceAnimation(anchoredAnimationModel, animationName); } } }