protected void PlayActionSequence ( ArrayList p_actionSequence ) { // check here if cueueble or action is uninteractibe. if( !this.IsInteractible() ) { if( m_bEventIsCueable ) { // Sanity check.. // 1. Should not Add ActionSequence that is currently playing // 2. Should not Add ActionSequence that is already in cue foreach( string action in p_actionSequence ) { bool containsAction = false; foreach( string cuedAction in m_cuedActions ) { if( action.Equals(cuedAction) ) containsAction = true; } if( !containsAction ) { m_cuedActions.Add(action); } #if DEBUG_CUEABLES if( containsAction ) Debug.LogError("Dragon::PlayActionSequence Dragon is not Interactible. adding "+action+" to cue."); else Debug.LogError("Dragon::PlayActionSequence Dragon is not Interactible and already contains cueable "+action+" action."); #else if( containsAction ) Log("Dragon::PlayActionSequence Dragon is not Interactible. adding "+action+" to cue."); else Log("Dragon::PlayActionSequence Dragon is not Interactible and already contains cueable "+action+" action."); #endif } return; } #if DEBUG_CUEABLES Debug.LogError("Dragon::PlayActionSequence Cannot Play this Action because Action is not Interactibe."); //Debug.Break(); #else //Log("Dragon::PlayActionSequence Cannot Play this Action:"+MiniJSON.jsonEncode(p_actionSequence)+" because Action is not Interactibe."); Debug.LogWarning("Dragon::PlayActionSequence Cannot Play this Action:"+MiniJSON.jsonEncode(p_actionSequence)+" because Action is not Interactibe. \n"); #endif return; } // clear actions DragonAnimationQueue.getInstance().ClearAll(); SoundManager.Instance.StopAnimationSound( PettingMain.Instance.HeadSoundContainer ); SoundManager.Instance.StopAnimationSound( PettingMain.Instance.BodySoundContainer ); SoundManager.Instance.StopAnimationSound( PettingMain.Instance.HeadAndBodySoundContainer ); foreach( string action in p_actionSequence ) { // Body Animations ArrayList bodyActionSequence = SequenceReader.GetInstance().ReadBodySequence(action); Log("----------- Playing Reaction:"+action+" -----------"); //LogWarning(">>>>>>> Checking action: \""+action+"\"\n"); if( bodyActionSequence != null ) { // +KJ:06132013 Shared Parameter. this supports the same random value that a cue is sharing foreach( object actionData in bodyActionSequence ) { ArrayList actionDataList = actionData as ArrayList; BodyData bodyData = new BodyData(); bodyData.Action = action; bodyData.Start = Utility.ParseToInt(actionDataList[0]); bodyData.ActionKey = actionDataList[1].ToString(); bodyData.Duration = float.Parse(actionDataList[2].ToString()); if( actionDataList.Count > 3 ) { bodyData.Param = actionDataList[3] as Hashtable; } bodyData.ExtractHashtableValues( bodyData.Param ); bodyData.EventTrigger = this.FormulateEventTriggers( bodyData.Param ); DragonAnimationQueue.getInstance().AddBodyCue( bodyData.GenerateHashtable() ); } } // Head Animations ArrayList headActionSequence = SequenceReader.GetInstance().ReadHeadSequence(action); if( headActionSequence != null ) { foreach( object actionData in headActionSequence ) { ArrayList actionDataList = actionData as ArrayList; HeadData headData = new HeadData(); headData.Action = action; headData.Start = Utility.ParseToInt(actionDataList[0]); headData.ActionKey = actionDataList[1].ToString(); headData.Duration = float.Parse(actionDataList[2].ToString()); if( actionDataList.Count > 3 ) { headData.Param = actionDataList[3] as Hashtable; } headData.ExtractHashtableValues( headData.Param ); headData.EventTrigger = this.FormulateEventTriggers( headData.Param ); DragonAnimationQueue.getInstance().AddHeadCue( headData.GenerateHashtable() ) ; } } // Update Queue ArrayList updateActionQueue = SequenceReader.GetInstance().ReadUpdate(action); if( updateActionQueue != null ) { foreach( object actionData in updateActionQueue ) { ArrayList actionDataList = actionData as ArrayList; UpdateData updateData = new UpdateData(); updateData.Action = action; updateData.Start = Utility.ParseToInt(actionDataList[0]); updateData.ActionKey = actionDataList[1].ToString(); updateData.Duration = float.Parse(actionDataList[2].ToString()); if( actionDataList.Count > 3 ) { updateData.Param = actionDataList[3] as Hashtable; } updateData.EventTrigger = this.FormulateEventTriggers( updateData.Param ); DragonAnimationQueue.getInstance().AddUpdateCue( updateData.GenerateHashtable() ); } } // Transition Queue ArrayList transitionQueue = SequenceReader.GetInstance().ReadTransform(action); if( transitionQueue != null ) { foreach( object actionData in transitionQueue ) { ArrayList actionDataList = actionData as ArrayList; TransformData transformData = new TransformData(); transformData.Action = action; transformData.Start = Utility.ParseToInt(actionDataList[0]); transformData.ActionKey = actionDataList[1].ToString(); transformData.Duration = float.Parse(actionDataList[2].ToString()); if( actionDataList.Count > 3 ) { transformData.Param = actionDataList[3] as Hashtable; } transformData.EventTrigger = this.FormulateEventTriggers( transformData.Param ); DragonAnimationQueue.getInstance().AddTransformCue( transformData.GenerateHashtable() ); } } ArrayList cameraQueue = SequenceReader.GetInstance().ReadCamera(action); if( cameraQueue != null ) { foreach( object actionData in cameraQueue ) { ArrayList actionDataList = actionData as ArrayList; CameraData cameraData = new CameraData(); cameraData.Action = action; cameraData.Start = Utility.ParseToInt(actionDataList[0]); cameraData.ActionKey = actionDataList[1].ToString(); cameraData.Duration = float.Parse(actionDataList[2].ToString()); if( actionDataList.Count > 3 ) { cameraData.Param = actionDataList[3] as Hashtable; } cameraData.EventTrigger = this.FormulateEventTriggers( cameraData.Param ); DragonAnimationQueue.getInstance().AddCameraCue( cameraData.GenerateHashtable() ); } } ArrayList eventQueue = SequenceReader.GetInstance().ReadEventTriggers(action); if( eventQueue != null ) { foreach( object actionData in eventQueue ) { ArrayList actionDataList = actionData as ArrayList; EventData eventData = new EventData(); eventData.Action = action; eventData.Start = Utility.ParseToInt(actionDataList[0]); eventData.ActionKey = actionDataList[1].ToString(); eventData.Duration = float.Parse(actionDataList[2].ToString()); if( actionDataList.Count > 3 ) { eventData.Param = actionDataList[3] as Hashtable; } eventData.EventTrigger = this.FormulateEventTriggers( eventData.Param ); DragonAnimationQueue.getInstance().AddEventCue( eventData.GenerateHashtable() ); } } // + LA 072613 ArrayList soundQueue = SequenceReader.GetInstance().ReadSounds(action); if( soundQueue != null ) { foreach( object actionData in soundQueue ) { ArrayList actionDataList = actionData as ArrayList; SoundData soundData = new SoundData(); soundData.Action = action; soundData.Start = Utility.ParseToInt(actionDataList[0]); soundData.ActionKey = actionDataList[1].ToString(); soundData.Duration = float.Parse(actionDataList[2].ToString()); if( actionDataList.Count > 3 ) { soundData.Param = actionDataList[3] as Hashtable; } soundData.EventTrigger = this.FormulateEventTriggers( soundData.Param ); DragonAnimationQueue.getInstance().AddSoundCue( soundData.GenerateHashtable() ); } } // - LA } DragonAnimationQueue.getInstance().PlayQueuedAnimations(); }