void Start() { alphaData = ApCtrl.CreateAlphaData(ApCtrl.SpineMeshAlpha(mr), this); alphaData.TargehAlphaNormed = 0; originScaleY = transform.localScale.y; controller.jumpEvent += () => { SetAnimate("jump up start", false); //animation.state.SetAnimation(0, "jump up start", false); Timer.BeginATimer(0.333f, () => { if (animation.AnimationName == "jump up start") { //animation.AnimationName = "jump up"; SetAnimate("jump up", true); } }, this); //animation.state.AddAnimation(0, "jump up", true, 0.333f); }; controller.AddEnterEventBeforeEnter <PlayerController.RushState>(() => { animation.timeScale = 0.3f / controller.rushTime; SetAnimate("rush", false); StartCoroutine(RushLightCoroutine()); StartCoroutine(RushTranslateCoroutine()); }); controller.AddEnterEventBeforeExit <PlayerController.RushState>(() => { animation.timeScale = 1; }); controller.AddEnterEventBeforeEnter <PlayerController.HurtState>(() => { animation.timeScale = 0.667f / controller.hurtStateTime; SetAnimate("hurt", false); }); controller.AddEnterEventBeforeExit <PlayerController.HurtState>(() => { animation.timeScale = 1; }); }
public void Awake() { lightMaskVisible = true; lightMaskAlpha = ApCtrl.CreateAlphaData(ApCtrl.LightRendererAlpha(lightRenderer), this); SelectedUIActive = false; meshAlpha = ApCtrl.CreateAlphaData(ApCtrl.SpineMeshAlpha(renderer), this); }
public IEnumerator EnergeGetedCorou(PlayerController player, Action <Vector2> afterAnim) { anim.state.TimeScale = 0; anim.state.SetAnimation(0, "animation", false);; GetComponent <BoxCollider2D>().enabled = false; var dir = (Position.x - player.PositionWithoutHalo.x) > 0 ? Vector2.right : Vector2.left; var movTimer = Timer.CreateATimer(disappearTime, null, this); movTimer.timerUpdateAction += () => { float dis = timeDistanceCurve.Evaluate(movTimer.Value); Vector2 target = dir.normalized * dis + originPos; Position = target; }; var rotTimer = Timer.CreateATimer(disappearTime, null, this); rotTimer.timerUpdateAction += () => { float rotSpeed = timeRotateSpeedCurve.Evaluate(rotTimer.Value); transform.Rotate(Vector3.forward * rotSpeed * Time.deltaTime); }; if (meshAp == null) { var mesh = anim.GetComponent <MeshRenderer>(); meshAp = ApCtrl.CreateAlphaData(ApCtrl.SpineMeshAlpha(mesh), this); } ApCtrl.DisappearAlpha(meshAp, disappearTime); if (lightAp == null) { lightAp = ApCtrl.CreateAlphaData(ApCtrl.LightRendererAlpha(lightRenderer), this); } ApCtrl.DisappearAlpha(lightAp, disappearTime); yield return(new WaitForSeconds(disappearTime)); afterAnim(Position); yield return(new WaitForSeconds(appearTime)); Position = originPos; transform.rotation = Quaternion.identity; ApCtrl.AppearAlpha(meshAp, disappearTime); ApCtrl.AppearAlpha(lightAp, disappearTime); GetComponent <BoxCollider2D>().enabled = true; anim.state.TimeScale = 1; anim.state.SetAnimation(0, "animation", true);; }