private bool FunctionPlayEndEye(Script_SpriteStudio6_Root scriptRoot, GameObject objectControl) { /* MEMO: Recommend not to change animation playing state in PlayEnd callback processing function. */ AnimationEyeRequest = KindAnimationEye.WAIT; TimeWaitBlinkEye = Random.Range((float)((int)Constant.BLANK_EYE_MIN), (float)((int)Constant.BLANK_EYE_MAX)) + 0.5f; /* MEMO: "Instance"'s PlayEnd callback processing function should never return false. */ /* "Instance" animation can not destroy self. (Returning false will also ignore it) */ /* If you really want to create state that "Instance" is disappeared, create hiding animation or hide "Instance"-part. */ return(true); }
private bool AnimationSetEye() { int idPartsEye; /* Set Animation (Left-eye and Right-eye) */ for (int i = 0; i < (int)KindEye.TERMINATOR; i++) { idPartsEye = TableIDPartsControlEye[i]; if (0 <= idPartsEye) { /* MEMO: Do not use ("Instance"'s) "AnimationSet" directly when changing "Instance"'s animation from script. */ /* Conflict with operation from parent animation. */ ScriptRoot.AnimationChangeInstance(idPartsEye, TableNameAnimationEye[(int)AnimationEyeRequest], Library_SpriteStudio6.KindIgnoreAttribute.PERMANENT, /* Maintain change even if parent's animation is changed */ true, /* Start immediate */ 1, 1.0f, Library_SpriteStudio6.KindStylePlay.NORMAL, "", 0, "", 0 ); } } AnimationEyePlaying = AnimationEyeRequest; AnimationEyeRequest = KindAnimationEye.NON; /* Set "Instance"'s PlayEnd-callback */ /* MEMO: To be honest, not advisable to change callback handling function considerably frequently. */ /* (Because take time to build delegate) */ /* Originally, seems that implementation like "Body" is desirable... */ if (null != ScriptRootInstanceEyeL) { if (KindAnimationEye.WAIT == AnimationEyePlaying) { ScriptRootInstanceEyeL.FunctionPlayEnd = null; } else { ScriptRootInstanceEyeL.FunctionPlayEnd = FunctionPlayEndEye; } } return(false); }
void Update() { /* Check Validity */ if (false == FlagInitialized) { /* Failed to initialize */ return; } /* Control Eye's Animations */ /* MEMO: "Blinking eyes" works asynchronously with body's animation. */ if (true == EyeCheckInitialized()) { TimeWaitBlinkEye -= Time.deltaTime; if (0.0f >= TimeWaitBlinkEye) { if (KindAnimationEye.BLINK != AnimationEyePlaying) { AnimationEyeRequest = KindAnimationEye.BLINK; } } if (KindAnimationBody.NON == AnimationBodyRequest) { if (KindAnimationEye.NON != AnimationEyeRequest) { /* Requested */ AnimationSetEye(); } } } /* Control Body's Animation */ if (KindAnimationBody.NON != AnimationBodyRequest) { /* Requested */ AnimationSetBody(); } }