public static RedLightPlayerController Create(PlayerController player, Vector2 _pos) { SinMove sm = new SinMove(player.rdLtSinMovDt); sm.data.originDeg = VectorUtils.Do(Vector2.zero, f => UnityEngine.Random.value * 360); var rdLtCtrl = new RedLightPlayerController(); rdLtCtrl.playerPosQueue = player.playerPosDisQueue; rdLtCtrl.sinMove = sm; rdLtCtrl.distanceSpeedCurve = player.rdLtDisSpdCv; rdLtCtrl.rlCtrl = RedLightController.Create(player, _pos); player.StartCoroutine(rdLtCtrl.FollowCor()); return(rdLtCtrl); }
private IEnumerator SwapDetect() { while (true) { var swapEnerge = swapEnergeDetect.GetMinDisDetects <SwapEnergeProperty>(); Action <Vector2> createRedLights = (pos) => { RedLightPlayerController[] rls = new RedLightPlayerController[swapCharges.MaxSwapChargeCount]; for (int i = 0; i < rls.Length; i++) { rls[i] = RedLightPlayerController.Create(this, pos); } swapCharges.FullCharge(rls); }; if (swapEnerge != null && !swapCharges.Fulled) { SoundManager.PlaySound(sound, "SwapEnerge"); swapEnerge.EnergeGeted(this, createRedLights); } yield return(new WaitForFixedUpdate()); } }