public override void ActionAnimSkip(ActionAnim action) { if (action.method == AnimMethod.PlayCustom && action.runtimeAnim && action.clip) { AdvGame.CleanUnusedClips(action.runtimeAnim); WrapMode wrap = WrapMode.Once; if (action.playMode == AnimPlayMode.PlayOnceAndClamp) { wrap = WrapMode.ClampForever; } else if (action.playMode == AnimPlayMode.Loop) { wrap = WrapMode.Loop; } AdvGame.PlayAnimClipFrame(action.runtimeAnim, 0, action.clip, action.blendMode, wrap, 0f, null, 1f); } else if (action.method == AnimMethod.StopCustom && action.runtimeAnim && action.clip) { AdvGame.CleanUnusedClips(action.runtimeAnim); action.runtimeAnim.Blend(action.clip.name, 0f, 0f); } else if (action.method == AnimMethod.BlendShape && action.shapeKey > -1) { if (action.runtimeShapeObject != null) { action.runtimeShapeObject.Change(action.shapeKey, action.shapeValue, 0f); } } }
private void MoveCamera() { if (target && animatedCameraType == AnimatedCameraType.SyncWithTargetMovement && clip && target) { AdvGame.PlayAnimClipFrame(GetComponent <Animation>(), 0, clip, AnimationBlendMode.Blend, WrapMode.Once, 0f, null, GetProgress()); } }
public override void ActionSpeechSkip(ActionSpeech action) { if (action.Speaker && action.Speaker.talkingAnimation == TalkingAnimation.CustomFace && (action.headClip || action.mouthClip)) { AdvGame.CleanUnusedClips(action.Speaker.GetAnimation()); if (action.headClip) { AdvGame.PlayAnimClipFrame(action.Speaker.GetAnimation(), AdvGame.GetAnimLayerInt(AnimLayer.Head), action.headClip, AnimationBlendMode.Additive, WrapMode.Once, 0f, action.Speaker.neckBone, 1f); } if (action.mouthClip) { AdvGame.PlayAnimClipFrame(action.Speaker.GetAnimation(), AdvGame.GetAnimLayerInt(AnimLayer.Mouth), action.mouthClip, AnimationBlendMode.Additive, WrapMode.Once, 0f, action.Speaker.neckBone, 1f); } } }
public override void TurnHead(Vector2 angles) { if (character == null) { return; } Animation animation = character.GetAnimation(); if (animation == null) { return; } // Horizontal if (character.headLookLeftAnim && character.headLookRightAnim) { if (angles.x < 0f) { animation.Stop(character.headLookRightAnim.name); AdvGame.PlayAnimClipFrame(animation, AdvGame.GetAnimLayerInt(AnimLayer.Neck), character.headLookLeftAnim, AnimationBlendMode.Additive, WrapMode.ClampForever, 0f, character.neckBone, 1f); animation [character.headLookLeftAnim.name].weight = -angles.x; animation [character.headLookLeftAnim.name].speed = 0f; } else if (angles.x > 0f) { animation.Stop(character.headLookLeftAnim.name); AdvGame.PlayAnimClipFrame(animation, AdvGame.GetAnimLayerInt(AnimLayer.Neck), character.headLookRightAnim, AnimationBlendMode.Additive, WrapMode.ClampForever, 0f, character.neckBone, 1f); animation [character.headLookRightAnim.name].weight = angles.x; animation [character.headLookRightAnim.name].speed = 0f; } else { animation.Stop(character.headLookLeftAnim.name); animation.Stop(character.headLookRightAnim.name); } } // Vertical if (character.headLookUpAnim && character.headLookDownAnim) { if (angles.y < 0f) { animation.Stop(character.headLookUpAnim.name); AdvGame.PlayAnimClipFrame(animation, AdvGame.GetAnimLayerInt(AnimLayer.Neck) + 1, character.headLookDownAnim, AnimationBlendMode.Additive, WrapMode.ClampForever, 0f, character.neckBone, 1f); animation [character.headLookDownAnim.name].weight = -angles.y; animation [character.headLookDownAnim.name].speed = 0f; } else if (angles.y > 0f) { animation.Stop(character.headLookDownAnim.name); AdvGame.PlayAnimClipFrame(animation, AdvGame.GetAnimLayerInt(AnimLayer.Neck) + 1, character.headLookUpAnim, AnimationBlendMode.Additive, WrapMode.ClampForever, 0f, character.neckBone, 1f); animation [character.headLookUpAnim.name].weight = angles.y; animation [character.headLookUpAnim.name].speed = 0f; } else { animation.Stop(character.headLookDownAnim.name); animation.Stop(character.headLookUpAnim.name); } } }
public override void ActionCharAnimSkip(ActionCharAnim action) { if (character == null) { return; } Animation animation = character.GetAnimation(); if (action.method == ActionCharAnim.AnimMethodChar.PlayCustom && action.clip) { if (action.layer == AnimLayer.Base) { character.charState = CharState.Custom; action.blendMode = AnimationBlendMode.Blend; action.playMode = (AnimPlayMode)action.playModeBase; } if (action.playMode == AnimPlayMode.PlayOnce) { if (action.layer == AnimLayer.Base && action.method == ActionCharAnim.AnimMethodChar.PlayCustom) { character.charState = CharState.Idle; character.ResetBaseClips(); } } else { AdvGame.CleanUnusedClips(animation); WrapMode wrap = WrapMode.Once; Transform mixingTransform = null; if (action.layer == AnimLayer.UpperBody) { mixingTransform = character.upperBodyBone; } else if (action.layer == AnimLayer.LeftArm) { mixingTransform = character.leftArmBone; } else if (action.layer == AnimLayer.RightArm) { mixingTransform = character.rightArmBone; } else if (action.layer == AnimLayer.Neck || action.layer == AnimLayer.Head || action.layer == AnimLayer.Face || action.layer == AnimLayer.Mouth) { mixingTransform = character.neckBone; } if (action.playMode == AnimPlayMode.PlayOnceAndClamp) { wrap = WrapMode.ClampForever; } else if (action.playMode == AnimPlayMode.Loop) { wrap = WrapMode.Loop; } AdvGame.PlayAnimClipFrame(animation, AdvGame.GetAnimLayerInt(action.layer), action.clip, action.blendMode, wrap, action.fadeTime, mixingTransform, 1f); } AdvGame.CleanUnusedClips(animation); } else if (action.method == ActionCharAnim.AnimMethodChar.StopCustom && action.clip) { if (action.clip != character.idleAnim && action.clip != character.walkAnim) { animation.Blend(action.clip.name, 0f, 0f); } } else if (action.method == ActionCharAnim.AnimMethodChar.ResetToIdle) { character.ResetBaseClips(); character.charState = CharState.Idle; AdvGame.CleanUnusedClips(animation); } else if (action.method == ActionCharAnim.AnimMethodChar.SetStandard) { if (action.clip != null) { if (action.standard == AnimStandard.Idle) { character.idleAnim = action.clip; } else if (action.standard == AnimStandard.Walk) { character.walkAnim = action.clip; } else if (action.standard == AnimStandard.Run) { character.runAnim = action.clip; } else if (action.standard == AnimStandard.Talk) { character.talkAnim = action.clip; } } if (action.changeSpeed) { if (action.standard == AnimStandard.Walk) { character.walkSpeedScale = action.newSpeed; } else if (action.standard == AnimStandard.Run) { character.runSpeedScale = action.newSpeed; } } if (action.changeSound) { if (action.standard == AnimStandard.Walk) { if (action.newSound != null) { character.walkSound = action.newSound; } else { character.walkSound = null; } } else if (action.standard == AnimStandard.Run) { if (action.newSound != null) { character.runSound = action.newSound; } else { character.runSound = null; } } } } }