/// <summary> /// Starts a new game. /// </summary> /// <param name="content">The content manager to load from.</param> private void StartGame(ContentManager content) { // create the game objects _scene = new Scene(); _scene.LoadContent(content); _fishing = new FishingState(this, _scene); _fishing.LoadContent(content); _ocean = new Ocean(_fishing); _ocean.LoadContent(content); _money = new Money(_fishing); _timer = new Timer(_fishing); _store = new Store(_money, _fishing); _store.LoadContent(content); _store.Hit += OnStoreHit; BadgeContext badgeContext = new BadgeContext(); badgeContext.Fishing = _fishing; badgeContext.Money = _money; badgeContext.Store = _store; badgeContext.Timer = _timer; _badges.Context = badgeContext; // create the views _sceneView = new SceneView(_scene, _camera); _sceneView.LoadContent(content); _oceanView = new OceanView(_ocean); _fishCaughtView = new FishCaughtView(_fishing); _fishEatenView = new FishEatenView(_fishing); _fishingView = new FishingView(_fishing, _context); _fishingView.LoadContent(content); _distanceView = new DistanceView(_scene, _fishing); _distanceView.LoadContent(content); _moneyView = new MoneyView(_money); _moneyView.LoadContent(content); _timerView = new TimerView(_timer); _timerView.LoadContent(content); _lureView = new LureView(_fishing, _store); _lureView.LoadContent(content); _storeView = new StoreView(_store); _storeView.LoadContent(content); _guideView = new GameGuideView(); _guideView.LoadContent(content); _guide = new GameGuide(_guideView, _fishing, _store, _money); _cameraController = new CameraController(_camera, _scene, _fishing); }
/// <summary> /// Handle notifications from the application. /// </summary> /// <param name="p_event"></param> /// <param name="p_target"></param> /// <param name="p_data"></param> public override void OnNotification(string p_event, Object p_target, params object[] p_data) { switch (p_event) { case "scene.load": Log("Scene [" + p_data[0] + "][" + p_data[1] + "] loaded"); break; case "ball.hit": string who = (string)p_data[0]; if (who == "ground") { app.model.bounces++; Log("Hit " + app.model.bounces); if (app.model.bounces >= app.model.winCondition) { app.view.ball.enabled = false; app.view.ball.GetComponent <Rigidbody>().isKinematic = true; Notify("game.complete"); } } break; case "game.complete": Log("Victory!"); app.view.timer.Play(); break; case "mid.trigger.enter": { Log("Mid Fall Enter!"); ColliderView c = (ColliderView)p_target; c.collider.enabled = false; } break; case "start.trigger.exit": { Log("Start Fall Exit!"); ColliderView c = (ColliderView)p_target; c.collider.enabled = false; } break; case "start.trigger.stay": { Log("Start Fall Stay [" + Time.time + "]"); } break; case "ping.timer.step": { TimerView t = (TimerView)p_target; Log("Ping " + t.step); } break; case "ping.timer.complete": { Log("Ping Complete!"); } break; } }
public TimerController(TimerView view) { _view = view; _model = GameModel.Instance.TimerModel; _model.Time.Subscribe(x => { _view.OnUpdateTime(x); }); }
private void HandleTimerResponse(object obj) { var response = obj as TimerResponse; Device.BeginInvokeOnMainThread(() => { var v = new TimerView(response); GameLogic.Instance.GameLength = response.gamelength; Navigation.PushAsync(v); }); }
// Start is called before the first frame update void Start() { sm = studyManager.GetComponent <StudyManager>(); jatv = judgeAndTimeView.GetComponent <JudgeAndTimeViewer>(); itvc = timerPanel.GetComponent <IntervalTimerViewController>(); it = intervalTimer.GetComponent <IntervalTimer>(); ctp = trialPanel.GetComponent <ControlTrialPanel>(); tv = timerView.GetComponent <TimerView>(); cx = Screen.width / 2; cy = Screen.height / 2; }
public ManagerPage(int idUser) { InitializeComponent(); App.AddTitle(TitleLayout); LytTimer.IsVisible = false; ActivityTimer = new TimerView(lblTime); // Load in data UserId = idUser; LoadData(UserId); }
private void Start() { TimerView timerView = GetComponent <TimerView>(); if (timerView.model == null) { timerView.model = new Timer(); } m_Component.timer = timerView.model; GameEntity entity = ComponentView.LinkGame(gameObject); int index = GameComponentsLookup.AirSupply; entity.AddComponent(index, m_Component); }
public App() { InitializeComponent(); var botherer = new Botherer(Tizen.System.Vibrator.Vibrators[0]); var timer = new MultiTimer(new HeartBit(1000), intervals); timer.TimeoutOccured += async(o, kind) => { switch (kind) { case TimeoutKind.First: await botherer.Disturb(); break; case TimeoutKind.Subsequent: await botherer.Bother(); break; case TimeoutKind.Last: await botherer.Disturb(); break; default: throw new ArgumentOutOfRangeException(nameof(kind), kind, "Unexpected timeout kind!"); } }; MainPage = new TimerView() { BindingContext = new TimerViewModel(timer) }; }
//Запуск таймера //Аргументы: длительность, делегат функции без аргументов, представление таймера public void Set(float _duration, Action action, TimerView view = null) { startDuration = currentDuration = _duration; timerView = view; onEnd = action; }
protected override void OnUse(InventoryItemData data) { base.OnUse(data); TimerView.SetPause(40); }