private IEnumerator PhysicsStepRoutine() { WaitFor waitForNewPhysicsStep = new WaitForEvent(typeof(PhysicsTimeStepEvent)); while (true) { yield return(waitForNewPhysicsStep); Output.Log("New physics step."); } }
private IEnumerator FrameStepRoutine() { WaitFor waitForNewFrame = new WaitForEvent(typeof(FrameUpdateEvent)); while (true) { yield return(waitForNewFrame); Output.Log("New frame drawn."); } }
void HandleGoal(GoalEvent goalEvent) { GoalComponent goalComp = goalEvent.Goal.GetComponent <GoalComponent>(); _owner.Engine.DestroyEntity(goalEvent.Ball); if (goalComp.For.Index == 0) { if (--player1Lives <= 0) { EventManager.Instance.QueueEvent(new PlayerLostEvent(_owner.Player1, _owner.Player2)); return; } } if (goalComp.For.Index == 1) { if (--player2Lives <= 0) { EventManager.Instance.QueueEvent(new PlayerLostEvent(_owner.Player2, _owner.Player1)); return; } } // Queue processes for next ball serve Process ballPlayProcess = new DelegateCommand(() => { if (goalComp.For.Index == 0) { PlayNewBall(_owner.Player1, true); } if (goalComp.For.Index == 1) { PlayNewBall(_owner.Player2, true); } }); // If there is a fluctuation, attach the serve to the fluctuation's end if (_fluctuationActive) { WaitForEvent fluctuationEnd = new WaitForEvent(typeof(FluctuationEndEvent)); fluctuationEnd.SetNext(ballPlayProcess); _processManager.Attach(fluctuationEnd); return; } // Attach the serve _processManager.Attach(ballPlayProcess); }