Exemple #1
0
        private IEnumerator enterCoroutine(PlayerController fsm)
        {
            Time.timeScale = 0f;
            fsm.blockMovement.staticExtrusion = false;
            dir = targetPosition - fsm.PositionWithoutHalo;
            fsm.swapSkill.UseSkill <SwapState>();
            var binding = fsm.swapCharges.GetSwapCharge();

            binding.value = 0;
            fsm.StartCoroutine(binding.redLight.SwapCor(fsm, targetPosition));
            var enemyRedLight = RedLightEnemyController.Create(fsm, targetPosition);

            fsm.StartCoroutine(enemyRedLight.SwapCor());
            EventBus.Notify("PlayerSwapEnter", fsm, fsm.swapProperty.disappearTime);
            float time = dir.magnitude / fsm.swapProperty.speed;

            target.SwapMove(-dir, time, fsm.swapProperty.disappearTime);
            //ApCtrl.DisappearAlpha(fsm.scaleAd, fsm.swapProperty.disappearTime);
            yield return(new WaitForSecondsRealtime(fsm.swapProperty.disappearTime));

            Swapable.SwapMove(dir, time, (pos) => fsm.blockMovement.Position = pos, () => fsm.PositionWithoutHalo, fsm);
            yield return(new WaitForSecondsRealtime(time));

            fsm.blockMovement.staticExtrusion = true;
            EventBus.Notify("PlayerSwapExit", fsm, fsm.swapProperty.disappearTime);
            //ApCtrl.AppearAlpha(fsm.scaleAd, fsm.swapProperty.disappearTime);
            yield return(new WaitForSecondsRealtime(fsm.swapProperty.disappearTime));

            Time.timeScale = 1;
            var v = fsm.blockMovement.Velocity;

            v *= 0;
            fsm.blockMovement.Velocity = v;
            fsm.ChangeState(last);
        }
Exemple #2
0
    public static RedLightEnemyController Create(PlayerController player, Vector2 enemeyPos)
    {
        var rleCtrl = new RedLightEnemyController();

        rleCtrl.enemyPos = enemeyPos;
        var rlCtrl = RedLightController.Create(player, enemeyPos);

        ApCtrl.SetAlphaImmediately(rlCtrl.lightAlpha, 0);
        ApCtrl.SetAlphaImmediately(rlCtrl.spriteAlpha, 0);
        rleCtrl.rlCtrl = rlCtrl;
        rleCtrl.player = player;
        return(rleCtrl);
    }