public IEnumerator SwapCor() { var playerPos = player.PositionWithoutHalo; float appearTime = player.swapProperty.disappearTime; ApCtrl.AppearAlpha(rlCtrl.lightAlpha, appearTime); ApCtrl.AppearAlpha(rlCtrl.spriteAlpha, appearTime); yield return(new WaitForSecondsRealtime(appearTime)); var dir = playerPos - enemyPos; var speed = player.swapProperty.speed; rlCtrl.EmissionEnable = true; rlCtrl.StartCoroutine(rlCtrl.MoveDirWithNormalOffset(dir , speed , player.rdLtSwapNormalDis)); var swapTime = dir.magnitude / speed; ApCtrl.DisappearAlpha(rlCtrl.lightAlpha, swapTime); ApCtrl.DisappearAlpha(rlCtrl.spriteAlpha, swapTime); yield return(new WaitForSecondsRealtime(swapTime)); yield return(new WaitForSecondsRealtime(2)); rlCtrl.Destroy(); }
public IEnumerator SwapCor(PlayerController player, Vector2 target) { follow = false; var time = player.swapProperty.disappearTime; var playerPos = player.PositionWithoutHalo; rlCtrl.StartCoroutine(rlCtrl.MoveToPos(player.PositionWithoutHalo, time, player.rdLtToPlayerTimeDisCurve)); yield return(new WaitForSecondsRealtime(time)); var dir = target - playerPos; var speed = player.swapProperty.speed; rlCtrl.EmissionEnable = true; rlCtrl.StartCoroutine(rlCtrl.MoveDirWithNormalOffset(dir , speed , player.rdLtSwapNormalDis)); var swapTime = dir.magnitude / speed; ApCtrl.DisappearAlpha(rlCtrl.lightAlpha, swapTime); ApCtrl.DisappearAlpha(rlCtrl.spriteAlpha, swapTime); yield return(new WaitForSecondsRealtime(swapTime)); rlCtrl.EmissionEnable = false; yield return(new WaitUntil(() => rlCtrl.lightAlpha.alphaRef.get() == 0)); yield return(new WaitForSecondsRealtime(2)); rlCtrl.Destroy(); }