public string AddOrEditMoveFactor(long localIdInFile, Vector3 move, string moveId = null, bool impactsAnimation = false, bool isCinematic = false, bool hasDuration = false, float duration = 0, Movable_OnMoveFactorEndCallback callback = null) { if (GetMoveFactor(localIdInFile, moveId) != null) { RemoveMoveFactor(localIdInFile, moveId, true); } return(AddMoveFactor(localIdInFile, move, impactsAnimation, isCinematic, hasDuration, duration, callback)); }
// /!\ Can only handle one source public void AddOrEditSelfMoveFactor(Vector3 move, bool hasDuration = false, float duration = 0, Movable_OnMoveFactorEndCallback callback = null) { selfMoveId = AddOrEditMoveFactor(localIdInFile, move, selfMoveId, true, false, hasDuration, duration, callback); }
/** * Adds a move factor. * Important : store the returned moveId to the caller's side. You'll need it to remove the move factor if you don't remove'em all at the same time. */ public string AddMoveFactor(long localIdInFile, Vector3 move, bool impactsAnimation = false, bool isCinematic = false, bool hasDuration = false, float duration = 0, Movable_OnMoveFactorEndCallback callback = null) { if (!moveFactorsContainer.ContainsKey(localIdInFile)) { moveFactorsContainer.Add(localIdInFile, new Dictionary <string, MoveFactorData>()); } string moveId = Helper.GenerateUniqueID(); MoveFactorData moveFactorData = new MoveFactorData { factor = move, type = isCinematic ? MoveFactorData.Type.CINEMATIC : MoveFactorData.Type.DEFAULT, isTimed = hasDuration, duration = duration, impactsAnimation = impactsAnimation, callback = callback }; moveFactorData.Awake(); moveFactorsContainer[localIdInFile].Add(moveId, moveFactorData); return(moveId); }