private bool FunctionPlayEndBody(Script_SpriteStudio6_Root scriptRoot, GameObject objectControl) { /* MEMO: Recommend not to change animation playing state in PlayEnd callback processing function. */ switch (AnimationBodyPlaying) { case KindAnimationBody.WAIT: if (0.5f < Random.value) { AnimationBodyRequest = KindAnimationBody.PUT_OUT_L; } else { AnimationBodyRequest = KindAnimationBody.WAIT; } CountRemain--; if (0 > CountRemain) { /* Destroy Self */ /* MEMO: Animation object destroys self when Highest-Parent animation's PlayEnd callback processing function returns false. */ return(false); } break; case KindAnimationBody.PUT_OUT_L: AnimationBodyRequest = KindAnimationBody.RETURN_L; break; case KindAnimationBody.RETURN_L: AnimationBodyRequest = KindAnimationBody.WAIT; break; } return(true); }
/* ----------------------------------------------- MonoBehaviour-Functions */ #region MonoBehaviour-Functions void Start() { /* Initialize WorkArea */ FlagInitializedEye = false; for (int i = 0; i < (int)KindEye.TERMINATOR; i++) { TableIDPartsControlEye[i] = -1; } /* Get Animation Control Script-Component */ GameObject gameObjectBase = GameObjectRoot; if (null == gameObjectBase) { gameObjectBase = gameObject; } ScriptRoot = Script_SpriteStudio6_Root.Parts.RootGet(gameObjectBase); if (null == ScriptRoot) { /* Error */ return; } /* Set PlayEnd-callback (for "Body") */ ScriptRoot.FunctionPlayEnd = FunctionPlayEndBody; /* Set initial animation */ AnimationBodyRequest = KindAnimationBody.WAIT; /* Initialize Complete */ FlagInitialized = true; }
private bool AnimationSetBody() { int indexAnimation = ScriptRoot.IndexGetAnimation(TableNameAnimationBody[(int)AnimationBodyRequest]); AnimationBodyPlaying = AnimationBodyRequest; AnimationBodyRequest = KindAnimationBody.NON; if (0 > indexAnimation) { /* Ignore */ return(false); } ScriptRoot.AnimationPlay(-1, indexAnimation, 1); return(true); }