コード例 #1
0
        public void TestRemove2()
        {
            TimerManager timerManager = new TimerManager();

            SharedStorage storage = CreateStorage("storage", timerManager);
            storage.Set("int", 10);
            storage.Set("float", 3.14f);
            storage.Set("bool", true);
            storage.Set("string", "This is a string");
            storage.Destroy();

            storage = CreateStorage("storage", timerManager, false);

            Assert.AreEqual(0, timerManager.Count());

            storage.Remove("foo");
            Assert.AreEqual(0, timerManager.Count());

            timerManager.Update(0.016f);

            storage = CreateStorage("storage", timerManager, false);
            Assert.AreEqual(10, storage.GetInt("int"));
            Assert.AreEqual(3.14f, storage.GetFloat("float"));
            Assert.AreEqual(true, storage.GetBool("bool"));
            Assert.AreEqual("This is a string", storage.GetString("string"));
        }
コード例 #2
0
ファイル: TimerManager.cs プロジェクト: lfwelove/lbp
 public static TimerManager GetInstance()
 {
     if (instance == null)
     {
         instance = new TimerManager();
     }
     return instance;
 }
コード例 #3
0
 public void Cancel()
 {
     if (!cancelled)
     {
         cancelled = true;
         manager.CancelTimer(this);
         manager = null;
     }
 }
コード例 #4
0
        public SharedStorage(String filename, TimerManager timerManager)
        {
            m_filename = filename;
            m_timerManager = timerManager;

            if (!Load(filename))
            {
                m_data = new Dictionary<String, Object>();
            }
        }
コード例 #5
0
        static void Main(string[] args)
        {
            TimerManager timer = new TimerManager();
            AlarmClock alarmClock = new AlarmClock(timer);
            Finisher finisher = new Finisher(timer);

            timer.Start(5000);

            alarmClock.Unregister(timer);

            timer.Start(2000);
            Console.ReadKey();
        }
コード例 #6
0
        /* mock constructor */
        protected Field(int width, int height)
        {
            currentField = this;
            cells = new FieldCellArray(width, height);

            timerManager = new TimerManager();
            players = new PlayerList(timerManager, CVars.cg_maxPlayers.intValue);

            m_tempCellsList = new LinkedList<FieldCell>();
            m_tempMovableList = new List<MovableCell>();

            movableCells = new LinkedList<MovableCell>();
        }
コード例 #7
0
        public Field(Game game)
        {
            m_game = game;

            currentField = this;
            timerManager = new TimerManager();
            players = new PlayerList(timerManager, CVars.cg_maxPlayers.intValue);

            m_tempCellsList = new LinkedList<FieldCell>();
            m_tempMovableList = new List<MovableCell>();

            movableCells = new LinkedList<MovableCell>();

            m_playerAnimations = new PlayerAnimations();
            m_bombAnimations = new BombAnimations();
        }
コード例 #8
0
        static void Main(string[] args)
        {
            TimerManager time = new TimerManager();
            AlarmClock alarm = new AlarmClock();
            Siren siren = new Siren();
            
            alarm.Register(time);
            time.Countdown(7);
            time.Countdown(7);
            alarm.UnRegister(time);
            time.Countdown(7);
            siren.Register(time);
            time.Countdown(4);
            siren.UnRegister(time);

            Console.ReadKey();
        }
コード例 #9
0
        public void TestPost0()
        {
            TimerManager timerManager = new TimerManager();

            List<String> result = new List<String>();

            notifications = new NotificationCenter(timerManager);
            notifications.Register("name", Callback1);
            notifications.Register("name", Callback2);
            notifications.Register("name", Callback3);

            notifications.Post(this, "name", result);

            Check(result);
            Assert.AreEqual(timerManager.Count(), 1);

            timerManager.Update(0.016f);

            Check(result, "Callback1", "Callback2", "Callback3");
            Assert.AreEqual(timerManager.Count(), 0);
        }
コード例 #10
0
        public void TestClear()
        {
            TimerManager timerManager = new TimerManager();

            SharedStorage storage = CreateStorage("storage", timerManager);
            storage.Set("int", 10);
            storage.Set("float", 3.14f);
            storage.Set("bool", true);
            storage.Set("string", "This is a string");

            timerManager.Update(0.016f);

            storage = CreateStorage("storage", timerManager, false);
            storage.Clear();

            timerManager.Update(0.016f);

            storage = CreateStorage("storage", timerManager, false);
            Assert.AreEqual(0, storage.GetInt("int"));
            Assert.AreEqual(0.0f, storage.GetFloat("float"));
            Assert.AreEqual(false, storage.GetBool("bool"));
            Assert.AreEqual(null, storage.GetString("string"));
        }
コード例 #11
0
        public void TestSaveLoad2()
        {
            TimerManager timerManager = new TimerManager();

            SharedStorage storage = CreateStorage("storage", timerManager);
            Assert.AreEqual(0, storage.GetInt("int"));
            Assert.AreEqual(0.0f, storage.GetFloat("float"));
            Assert.AreEqual(false, storage.GetBool("bool"));
            Assert.AreEqual(null, storage.GetString("string"));
        }
コード例 #12
0
 void Start()
 {
     instance = this;
 }
コード例 #13
0
ファイル: Engine.cs プロジェクト: Insane-96/aivengine-1
        protected void Initialize()
        {
            // crappy
            new AudioSource();

            Camera = new Camera();

            // create dictionaries
            Objects = new Dictionary<string, GameObject>();
            SortedObjects = new SortedSet<GameObject>(new GameObjectComparer());
            Assets = new Dictionary<string, Asset>();

            dirtyObjects = new Dictionary<GameObject, int>();

            Joysticks = new Joystick[8];

            debugCollisionsBoxes = new Dictionary<GameObject.HitBox, RectangleObject>();

            Timer = new TimerManager(this);
        }
コード例 #14
0
 private void Awake()
 {
     ins = this;
 }
コード例 #15
0
ファイル: Timer.cs プロジェクト: Sammmte/MoonLander
 public void AddToManager()
 {
     TimerManager.GetInstance().AddTimer(this);
 }
コード例 #16
0
ファイル: TTService.cs プロジェクト: rickboy/TTController
        public bool Initialize()
        {
            Logger.Info($"{new string('=', 64)}");
            Logger.Info("Initializing...");
            PluginLoader.LoadAll($@"{AppDomain.CurrentDomain.BaseDirectory}\Plugins");

            const string key = "config-file";

            if (string.IsNullOrEmpty(AppSettingsHelper.ReadValue(key)))
            {
                AppSettingsHelper.WriteValue(key, "config.json");
            }

            _configManager = new ConfigManager(AppSettingsHelper.ReadValue(key));
            if (!_configManager.LoadOrCreateConfig())
            {
                return(false);
            }

            _cache = new DataCache();

            var alpha           = Math.Exp(-_configManager.CurrentConfig.SensorTimerInterval / (double)_configManager.CurrentConfig.DeviceSpeedTimerInterval);
            var providerFactory = new MovingAverageSensorValueProviderFactory(alpha);
            var sensorConfigs   = _configManager.CurrentConfig.SensorConfigs
                                  .SelectMany(x => x.Sensors.Select(s => (Sensor: s, Config: x.Config)))
                                  .ToDictionary(x => x.Sensor, x => x.Config);

            _sensorManager          = new SensorManager(providerFactory, sensorConfigs);
            _effectManager          = new EffectManager();
            _speedControllerManager = new SpeedControllerManager();
            _deviceManager          = new DeviceManager();

            _sensorManager.EnableSensors(sensorConfigs.Keys);
            foreach (var profile in _configManager.CurrentConfig.Profiles)
            {
                foreach (var effect in profile.Effects)
                {
                    _effectManager.Add(profile.Guid, effect);
                    _sensorManager.EnableSensors(effect.UsedSensors);
                }

                foreach (var speedController in profile.SpeedControllers)
                {
                    _speedControllerManager.Add(profile.Guid, speedController);
                    _sensorManager.EnableSensors(speedController.UsedSensors);
                }
            }

            foreach (var sensor in _sensorManager.EnabledSensors)
            {
                _cache.StoreSensorConfig(sensor, SensorConfig.Default);
            }

            foreach (var controller in _deviceManager.Controllers)
            {
                foreach (var port in controller.Ports)
                {
                    _cache.StorePortConfig(port, PortConfig.Default);
                }
            }

            foreach (var(ports, config) in _configManager.CurrentConfig.PortConfigs)
            {
                foreach (var port in ports)
                {
                    _cache.StorePortConfig(port, config);
                }
            }

            foreach (var(sensors, config) in _configManager.CurrentConfig.SensorConfigs)
            {
                foreach (var sensor in sensors)
                {
                    _cache.StoreSensorConfig(sensor, config);
                }
            }

            ApplyComputerStateProfile(ComputerStateType.Boot);

            _timerManager = new TimerManager();
            _timerManager.RegisterTimer(_configManager.CurrentConfig.SensorTimerInterval, SensorTimerCallback);
            _timerManager.RegisterTimer(_configManager.CurrentConfig.DeviceSpeedTimerInterval, DeviceSpeedTimerCallback);
            _timerManager.RegisterTimer(_configManager.CurrentConfig.DeviceRgbTimerInterval, DeviceRgbTimerCallback);
            if (LogManager.Configuration.LoggingRules.Any(r => r.IsLoggingEnabledForLevel(LogLevel.Debug)))
            {
                _timerManager.RegisterTimer(_configManager.CurrentConfig.LoggingTimerInterval, LoggingTimerCallback);
            }

            _timerManager.Start();

            Logger.Info("Initializing done!");
            Logger.Info($"{new string('=', 64)}");
            return(true);
        }
コード例 #17
0
ファイル: LogicTest.cs プロジェクト: nickplus11/KeepWorking
        public void TestSaving()
        {
            TimerManager tm = new TimerManager();

            tm.SaveAll();
        }
コード例 #18
0
    //////////////////////////////////////////////////////////////////////////////

    #region Shared instance

    static TimerManager()
    {
        s_sharedInstance = new TimerManager();
    }
コード例 #19
0
 private void Reset()
 {
     next = prev = null;
     manager = null;
     callback = null;
     numRepeats = numRepeated = 0;
     timeout = 0;
     fireTime = 0;
     scheduleTime = 0;
     cancelled = false;
     name = null;
     userData = null;
 }
コード例 #20
0
 public void Exit(EntityParent entity, params object[] args)
 {
     TimerManager.DelTimer(this.AttackTimer);
 }
コード例 #21
0
        public virtual void Update()
        {
            TimerManager.GetInstance().Trigger();
            MsgCallManager.Run();
            EventSystem.update();

            if (sceneCamera != null)
            {
                //点击波纹
                if (nguiCamera != null && Input.GetMouseButtonUp(0))
                {
                    Vector3 p = Input.mousePosition;
                    if (_clickEffect != null)
                    {
                        Ray        uiRay = nguiCamera.ScreenPointToRay(Input.mousePosition);
                        RaycastHit uiHit = new RaycastHit();
                        if (Physics.Raycast(uiRay, out uiHit, 1000, 1 << LayerMask.NameToLayer("ValidViewArea")))
                        {
                            _clickEffect.layer = LayerMask.NameToLayer("UI");
                            _clickEffect.transform.position = uiHit.point;
                            _clickEffect.GetComponent <ParticleSystem>().Play();
                        }
                    }
                }
                if (bCanDrag || bCanClick)
                {
                    if (_bPressed)
                    {
                        Vector3 mousePose = Input.mousePosition;//cam.ScreenToWorldPoint(Input.mousePosition);//hitt.transform.position; //
                        float   offsetX   = mousePose.x - _pressedMousePos.x;
                        if (Mathf.Abs(offsetX) >= 10f)
                        {
                            _bDraging = true;
                        }
                    }
                    if (Input.GetMouseButtonDown(0))//点下去
                    {
                        _pressedMousePos = Input.mousePosition;
                        _bPressed        = false;
                        _bDraging        = false;
                        clickTarget      = null;
                        if (!ClickUI()) //没点到UI
                        {
                            if (bCanClick)
                            {
                                /*if (UIManager.IsWinShow(UIName.BATTLE_SCENE_2D_WIN))
                                 * {
                                 *  clickTarget = ClickSeaHorizontal(out temp_pos);
                                 * }
                                 * else
                                 * {
                                 *  clickTarget = ClickScene(out temp_pos);
                                 * }*/
                                clickTarget = ClickScene(out temp_pos);
                                EventMultiArgs args = new EventMultiArgs();
                                if (clickTarget != null)//有点到东西
                                {
                                    args.AddArg("target", clickTarget);
                                    args.AddArg("hitPos", temp_pos);
                                }
                                args.AddArg("mousePos", _pressedMousePos);
                                EventSystem.CallEvent(EventID.PRESS_SCENE_TARGET, args, true);
                            }
                            _bPressed = true;
                        }
                    }
                    else if (Input.GetMouseButtonUp(0))//弹起
                    {
                        if (!bCanClick)
                        {
                            //不用处理点击事件
                        }
                        else if (clickTarget == null)
                        {
                            //没点到东西
                            EventSystem.CallEvent(EventID.PRESS_CANCEL_PRESS, new EventMultiArgs(), true);
                        }
                        else if (!bCanDrag && _bDraging)
                        {
                            //手指正在拖动,不用触发点击事件
                            EventSystem.CallEvent(EventID.PRESS_CANCEL_PRESS, new EventMultiArgs(), true);
                        }
                        else if (bCanDrag && _dragPath != null && _dragPath.IsDraged())
                        {
                            //正在拖动,不用触发点击事件
                        }
                        else if (bCanDrag && _dragInRect != null && _dragInRect.IsDraged())
                        {
                            //正在拖动,不用触发点击事件
                        }
                        else
                        {
                            EventMultiArgs args = new EventMultiArgs();
                            args.AddArg("target", clickTarget);
                            EventSystem.CallEvent(EventID.CLICK_SCENE_TARGET, args, true);
                        }
                        EventSystem.CallEvent(EventID.PRESS_REBOUND_PRESS, new EventMultiArgs(), true);



                        clickTarget = null;
                        _bPressed   = false;
                        _bDraging   = false;
                    }
                }
            }
        }
コード例 #22
0
        public ServiceManager(
            NodeContainer container, CacheStorage storage, Logger logger, TimerManager timerManager,
            BoundServiceManager boundServiceManager,
            machoNet machoNet,
            objectCaching objectCaching,
            alert alert,
            authentication authentication,
            character character,
            userSvc userSvc,
            charmgr charmgr,
            config config,
            dogmaIM dogmaIM,
            invbroker invbroker,
            warRegistry warRegistry,
            station station,
            map map,
            account account,
            skillMgr skillMgr,
            contractMgr contractMgr,
            corpStationMgr corpStationMgr,
            bookmark bookmark,
            LSC LSC,
            onlineStatus onlineStatus,
            billMgr billMgr,
            facWarMgr facWarMgr,
            corporationSvc corporationSvc,
            clientStatsMgr clientStatsMgr,
            voiceMgr voiceMgr,
            standing2 standing2,
            tutorialSvc tutorialSvc,
            agentMgr agentMgr,
            corpRegistry corpRegistry,
            marketProxy marketProxy,
            stationSvc stationSvc,
            certificateMgr certificateMgr,
            jumpCloneSvc jumpCloneSvc,
            LPSvc LPSvc,
            lookupSvc lookupSvc,
            insuranceSvc insuranceSvc,
            slash slash,
            ship ship,
            corpmgr corpmgr,
            repairSvc repairSvc,
            reprocessingSvc reprocessingSvc,
            ramProxy ramProxy,
            factory factory)
        {
            this.Container           = container;
            this.CacheStorage        = storage;
            this.BoundServiceManager = boundServiceManager;
            this.TimerManager        = timerManager;
            this.Logger = logger;
            this.Log    = this.Logger.CreateLogChannel("ServiceManager");

            // store all the services
            this.machoNet        = machoNet;
            this.objectCaching   = objectCaching;
            this.alert           = alert;
            this.authentication  = authentication;
            this.character       = character;
            this.userSvc         = userSvc;
            this.charmgr         = charmgr;
            this.config          = config;
            this.dogmaIM         = dogmaIM;
            this.invbroker       = invbroker;
            this.warRegistry     = warRegistry;
            this.station         = station;
            this.map             = map;
            this.account         = account;
            this.skillMgr        = skillMgr;
            this.contractMgr     = contractMgr;
            this.corpStationMgr  = corpStationMgr;
            this.bookmark        = bookmark;
            this.LSC             = LSC;
            this.onlineStatus    = onlineStatus;
            this.billMgr         = billMgr;
            this.facWarMgr       = facWarMgr;
            this.corporationSvc  = corporationSvc;
            this.clientStatsMgr  = clientStatsMgr;
            this.voiceMgr        = voiceMgr;
            this.standing2       = standing2;
            this.tutorialSvc     = tutorialSvc;
            this.agentMgr        = agentMgr;
            this.corpRegistry    = corpRegistry;
            this.marketProxy     = marketProxy;
            this.stationSvc      = stationSvc;
            this.certificateMgr  = certificateMgr;
            this.jumpCloneSvc    = jumpCloneSvc;
            this.LPSvc           = LPSvc;
            this.lookupSvc       = lookupSvc;
            this.insuranceSvc    = insuranceSvc;
            this.slash           = slash;
            this.ship            = ship;
            this.corpmgr         = corpmgr;
            this.repairSvc       = repairSvc;
            this.reprocessingSvc = reprocessingSvc;
            this.ramProxy        = ramProxy;
            this.factory         = factory;
        }
コード例 #23
0
            void Awake()
            {
                Timer timer = TimerManager.CreateTimer(TimerStart, TimerUpdate, TimerExit, 1.0f);

                timer.BeginTimer();
            }
コード例 #24
0
 public void GetChart()
 {
     var Timer = new TimerManager(()
                                  => _hub.Clients.All.SendCoreAsync("TransferCharts", new[] { DataChartSimulationManager.Get() }));
 }
コード例 #25
0
        public void TestSaveLoad4()
        {
            TimerManager timerManager = new TimerManager();

            SharedStorage storage = CreateStorage("storage", timerManager);
            storage.Set("int", 10);

            timerManager.Update(0.016f);
            storage = CreateStorage("storage", timerManager, false);
            Assert.AreEqual(10, storage.GetFloat("int"));
        }
コード例 #26
0
 public void PressButton()
 {
     TimerManager.Instance().ResetGame();
 }
コード例 #27
0
ファイル: guildspeedpanel.cs プロジェクト: liuyongsz/bmobdemo
 protected override void OnDestroy()
 {
     base.OnDestroy();
     TimerManager.Destroy(mTimerUpgradeKey);
     mSpeedTime = 1;
 }
コード例 #28
0
        // this method will be marked as private in the future
        private void Initialize(IFileSystem fileSystem, IPathResolver resolver, IAsyncManager asyncManager, IScriptLogger logger, IO.IByteBufferAllocator byteBufferAllocator, BindAction binder)
        {
            if (fileSystem == null)
            {
                throw new NullReferenceException(nameof(fileSystem));
            }

            asyncManager.Initialize(_mainThreadId);

            _isValid   = true;
            _isRunning = true;
            _logger    = logger;
            // _rwlock = new ReaderWriterLockSlim();
            _rt = JSApi.JS_NewRuntime();
            JSApi.JS_SetHostPromiseRejectionTracker(_rt, JSApi.PromiseRejectionTracker, IntPtr.Zero);
#if UNITY_EDITOR
            JSApi.JS_SetInterruptHandler(_rt, _InterruptHandler, IntPtr.Zero);
#else
            if (isWorker)
            {
                JSApi.JS_SetInterruptHandler(_rt, _InterruptHandler, IntPtr.Zero);
            }
#endif
            JSApi.JS_SetRuntimeOpaque(_rt, (IntPtr)_runtimeId);
            JSApi.JS_SetModuleLoaderFunc(_rt, module_normalize, module_loader, IntPtr.Zero);
            CreateContext();
            JSApi.JS_NewClass(_rt, JSApi.class_finalizer);

            _pathResolver        = resolver;
            _asyncManager        = asyncManager;
            _byteBufferAllocator = byteBufferAllocator;
            _autorelease         = new Utils.AutoReleasePool();
            _fileSystem          = fileSystem;
            _objectCache         = new ObjectCache(_logger);
            _timerManager        = new TimerManager(_logger);
            _typeDB = new TypeDB(this, _mainContext);
#if !JSB_UNITYLESS
            _typeDB.AddType(typeof(Unity.JSBehaviour), JSApi.JS_UNDEFINED);
            _typeDB.AddType(typeof(Unity.JSScriptableObject), JSApi.JS_UNDEFINED);
#endif
#if UNITY_EDITOR
            _typeDB.AddType(Values.FindType("QuickJS.Unity.JSEditorWindow"), JSApi.JS_UNDEFINED);
            _typeDB.AddType(Values.FindType("QuickJS.Unity.JSBehaviourInspector"), JSApi.JS_UNDEFINED);
#endif

            // await Task.Run(() => runner.OnBind(this, register));
            try
            {
                binder?.Invoke(this);
            }
            catch (Exception exception)
            {
                _logger?.WriteException(exception);
            }

            var register = _mainContext.CreateTypeRegister();
            if (!_isWorker)
            {
                JSWorker.Bind(register);
            }
            TimerManager.Bind(register);
            extraBinding?.Invoke(this, register);
            register.Finish();

            AddStaticModule("jsb", ScriptContext.Bind);
            // FindModuleResolver<StaticModuleResolver>().Warmup(_mainContext);

            _isInitialized = true;
            OnInitialized?.Invoke(this);
        }
コード例 #29
0
 void Start()
 {
     player = FindObjectOfType<MasterController>();
     playedOnce = false;
     isplayerInWarp = false;
     keyCollected = false;
     warpSFX = GetComponent<AudioSource>();
     timerManager = FindObjectOfType<TimerManager>();
     warpSFXDuration = 1.3f;
 }
コード例 #30
0
    IEnumerator AnimateToPosition(Vector3 startingPosition, Vector3 targetPosition)
    {
        float timer         = 0;
        float time          = 1;
        float rotationSpeed = Random.Range(cownonBallStatistics.rotationSpeed.x, cownonBallStatistics.rotationSpeed.y);

        while (timer < time)
        {
            timer += Time.deltaTime;

            transform.position = Vector3.LerpUnclamped(startingPosition, targetPosition,
                                                       cownonBallStatistics.movementCurve.Evaluate(timer / time));

            transform.localScale = Vector3.Lerp(cownonBallStatistics.initialScale * Vector3.one, cownonBallStatistics.finalScale * Vector3.one,
                                                cownonBallStatistics.scaleCurve.Evaluate(timer / time));

            transform.Rotate(Vector3.forward, rotationSpeed * Time.deltaTime);

            yield return(null);
        }

        var trump = Physics2D.OverlapCircle(targetPosition, 0.5f, trumpLayer);

        float   trumpRadius      = 1f;
        Vector2 trumpPosition    = new Vector2(Trump.Instance.transform.position.x, Trump.Instance.transform.position.y);
        float   cowTrumpDistance = Vector2.Distance(trumpPosition, transform.position);

        float radiusesSum = trumpRadius + cownonBallStatistics.finalScale;

        Debug.Log("Radiuses sum: " + radiusesSum + " trump rad: " + trumpRadius +
                  " cow rad: " + cownonBallStatistics.finalScale);

        if (cowTrumpDistance < radiusesSum)
        {
            this.GetComponent <Rigidbody2D>().simulated = true;
            this.GetComponent <Rigidbody2D>().AddForce(new Vector2(Random.Range(-200, 200), Random.Range(-200, 200)));
            this.GetComponent <Rigidbody2D>().AddTorque(rotationSpeed);
            this.GetComponent <SpriteRenderer>().sortingOrder = -10;
            AudioManager.Instance.PlaySfx(5);

            Trump.Instance.HitTrump();
            yield break;
        }

        if (hole != null)
        {
            if (!hole.busy)
            {
                this.GetComponent <SpriteRenderer>().sprite = cownonBallStatistics.StuckSprite[Random.Range(0, cownonBallStatistics.StuckSprite.Length)];
                hole.occowpied    = this;
                hole.instance.cow = this.GetComponent <SpriteRenderer>();
                this.GetComponent <SpriteRenderer>().sortingOrder = -10;
                TimerManager.AddPoint();
                AudioManager.Instance.PlaySfx(5);
            }
            else
            {
                this.GetComponent <Rigidbody2D>().simulated = true;
                this.GetComponent <Rigidbody2D>().AddForce(new Vector2(Random.Range(-200, 200), Random.Range(-200, 200)));
                this.GetComponent <Rigidbody2D>().AddTorque(rotationSpeed);
                this.GetComponent <SpriteRenderer>().sortingOrder     = -10;
                hole.occowpied.GetComponent <Rigidbody2D>().simulated = true;
                hole.occowpied.GetComponent <Rigidbody2D>().AddTorque(rotationSpeed);
                hole.occowpied.GetComponent <SpriteRenderer>().sprite       = cownonBallStatistics.flyingSprite[Random.Range(0, cownonBallStatistics.flyingSprite.Length)];
                hole.occowpied.GetComponent <SpriteRenderer>().sortingOrder = -10;
                hole.occowpied.GetComponent <Rigidbody2D>().AddForce(new Vector2(Random.Range(-200, 200), Random.Range(-200, 200)));
                hole.occowpied = null;
                AudioManager.Instance.PlaySfx(4);
                TimerManager.RemovePoint();
            }

            HolesManager.Instance.CowReachedHole(hole);
            timer = 0;
            time  = 0.8f;
            Vector3 cachedScale = this.transform.localScale;
            while (timer < time)
            {
                timer += Time.deltaTime;

                transform.localScale = Vector3.LerpUnclamped(cachedScale, cachedScale * 1.5f,
                                                             cownonBallStatistics.insertionCurve.Evaluate(timer / time));

                yield return(null);
            }
        }
        else
        {
            HolesManager.Instance.AddNewHole(targetPosition);
            this.GetComponent <Rigidbody2D>().simulated = true;
            TimerManager.RemovePoint();
        }
    }
コード例 #31
0
 public override void OnPlayerRespawn()
 {
     base.OnPlayerRespawn();
     m_iTimerHandle = TimerManager.AddTimer(Random.Range(m_fSpawnTimeMin, m_fSpawnTimeMax), SpawnMissile);
 }
コード例 #32
0
ファイル: Program.cs プロジェクト: kdoCeleron/PrivateTools
        /// <summary>
        /// タスクトレイの設定を初期化します。
        /// </summary>
        private static void InitializeTaskTray()
        {
            // タスクトレイの設定
            var icon = new NotifyIcon();

            icon.Icon     = new System.Drawing.Icon(@".\icon\main.ico");
            icon.Visible  = true;
            icon.Text     = "タスク管理ツール";
            icon.MouseUp += TaskTrayMenuEvents.IconOnMouseUp;

            var menu = new ContextMenuStrip();

            {
                var menuItem = new ToolStripMenuItem();
                menuItem.Text   = "メイン画面表示";
                menuItem.Click += TaskTrayMenuEvents.ShowMainForm;
                menu.Items.Add(menuItem);
            }

            {
                var menuItem = new ToolStripMenuItem();
                menuItem.Text   = "タスク一覧をCSV出力";
                menuItem.Click += TaskTrayMenuEvents.OutputCsvTaskList;
                menu.Items.Add(menuItem);
            }

            {
                var menuItem = new ToolStripMenuItem();
                menuItem.Text   = "実行フォルダを開く";
                menuItem.Click += TaskTrayMenuEvents.ShowExecFolder;
                menu.Items.Add(menuItem);
            }

            {
                var menuItem = new ToolStripMenuItem();
                menuItem.Text   = "設定変更";
                menuItem.Click += TaskTrayMenuEvents.ShowConfigEditForm;
                menu.Items.Add(menuItem);
            }

            {
                var menuItem = new ToolStripMenuItem();
                menuItem.Text   = "終了";
                menuItem.Click += TaskTrayMenuEvents.ApplicationExit;
                menu.Items.Add(menuItem);
            }

            icon.ContextMenuStrip = menu;

            TaskTrayMenuEvents.Icon = icon;

            Application.ApplicationExit += (sender, e) =>
            {
                if (TaskTrayMenuEvents.Icon != null)
                {
                    TaskTrayMenuEvents.Icon.Dispose();
                    TaskTrayMenuEvents.Icon = null;
                }

                TimerManager.DisposeTimer(TermOutTimerKey);
            };
        }
コード例 #33
0
ファイル: TimerManager.cs プロジェクト: ocknon/GAM24Final
 void OnApplicationQuit()
 {
     vInstance = null;
 }
コード例 #34
0
ファイル: LoadMap.cs プロジェクト: ericamccowan/ILS
        public void tmxLoading( ref string mapName, ref Vector2 nextRoomSize, ref Vector2 nextRoomStart, ref Map currentMap, ref Camera camera, ref Collision collision, ref AssistManager assistManager, ref AnimationManager animationManager, ref DoorManager doorManager, ref TimerManager timerManager, ref NPCManager npcManager, ref Player player1, ref Player player2 )
        {
            // Start tmxloading Class.

            #region Setting up variables, ect.

            // Temp Map variables:
            byte row;
            byte column;
            int layerHeight;
            currentMap.layerNumber = -1; // Setting this to -1 so that the case statement will start at 0 without the need for a if statement.
            int tempLayerNumber;
            int tempTileGID;
            int tempMapWidth = 0;

            // Temp data to reduce function calls:
            int currentMapTileHeight;
            Vector2 screenOffset;

            // Temp values for Tileset and Image data:
            int tilesetOffset;
            string tilesetName;
            int tilesetWidth;
            int tilesetHeight;
            int tileWidth;
            int tileHeight;
            ulong trans;

            // Initializing object variables:

            // Basic object data:
            string tempName;
            string tempType;
            Vector2 tempPosition;
            int tempWidth;
            int tempHeight;
            bool tempHighlightAble;
            bool tempGlow;
            bool tempDraw;
            int tempLayer;
            bool tempCollidable;

            // Tileset & tileID data:
            string tempTileset;
            int tempTileID;
            int tempDestroyedTileID;
            int tempOpenTileID;
            int tempEmptyTileID;

            // Transition & Door specific data:
            string tempNextMap;
            Vector2 tempExitPosition;
            string tempExitDirection;
            Vector2 tempNextRoomSize;
            Vector2 tempNextRoomStart;
            string tempKey;
            bool tempAutoOpen;

            // Container specific data:
            bool tempIsFull;
            bool tempIsOpen;

            // Readable specific data:
            string tempConvoIndex;

            // Destroyable specific data:
            bool tempIsDestroyed;
            float tempHP;

            // Movable specific data:
            bool tempMovable;
            bool tempThrowable;

            // Switch specific data:
            string tempActivatable;

            // Actavatable specific data:
            Vector2 tempSlideEnd;
            float tempSlideTime;

            // Animation specific data:
            bool tempRunning;
            bool tempContinuous;
            int tempPlayCountMax;
            bool tempReverse;

            // NPC Specific data:
            int tempAge;
            bool tempMale;
            float tempWalkSpeed;
            float tempRunSpeed;

            #endregion

            currentMap.mapName = mapName; // Setting the map name.
            camera.currentRoomSize = nextRoomSize;
            camera.currentRoomStart = nextRoomStart;
            currentMap.currentRoomStart = nextRoomStart;

            // Default information that must be set because I am using a switch to load information:
            currentMapTileHeight = Globals.tileSize;
            screenOffset = Vector2.Zero;

            // Opening the map then reading it:
            using ( XmlReader reader = XmlReader.Create( content.RootDirectory + @"\Maps\" + mapName + ".tmx" ))

                while ( reader.Read() )
                { // Start read file while.

                    // Only detect start elements.
                    if ( reader.IsStartElement() )
                    { // Start IsStartElement if.

                        // Get element name and switch on it.
                        switch( reader.Name )
                        { // Start reader.Name switch.

                            #region Map Case.
                            case "map":

                                // Map Data attributes:
                                currentMap.mapVersion = Convert.ToSingle( reader["version"] );
                                currentMap.mapOrientation = reader["orientation"];
                                currentMap.mapWidth =  Convert.ToUInt16( reader["width"] );
                                currentMap.mapHeight = Convert.ToUInt16( reader["height"] );
                                currentMap.mapTileWidth = Convert.ToUInt16(reader["tilewidth"]);
                                currentMap.mapTileHeight = Convert.ToUInt16(reader["tileheight"]);
                                if ( currentMap.Rows.Count == 0 ) // Making sure the cell list has not been initialized yet;
                                {
                                    currentMap.initalizeCellList(); // Setting the map list to the correct size.
                                }

                                camera.resetCamera( ref nextRoomSize );

                                // Temp data to reduce function calls:
                                currentMapTileHeight = currentMap.mapTileHeight;

                                tempMapWidth = currentMap.mapWidth - 1;

                                screenOffset = camera.screenOffset;

                                collision.screenOffset = screenOffset;

                                break; // End Map Data case.
                            #endregion

                            #region Tileset Case
                            case "tileset":

                                #region Initalizing variables

                                // Initializing variables:
                                //tOffset = 0;
                                //tName = "";
                                //tWidth = 0;
                                //tHeight = 0;
                                //tsWidth = 0;
                                //tsHeight = 0;
                                //trans = 0;

                                #endregion

                                // Reading the "tileset" attributes:
                                tilesetOffset = Convert.ToUInt16(reader["firstgid"]);
                                tilesetName = reader["name"];

                                // Breaking if a tileset should not be loaded:
                                if ( tilesetName == "Animation" )
                                {
                                    break;
                                }

                                tileWidth = Convert.ToUInt16(reader["tilewidth"]);
                                tileHeight = Convert.ToUInt16(reader["tileheight"]);

                                // Moving to the "image" element:
                                reader.ReadToFollowing("image");

                                // REading the "image" attributes:
                                trans = Convert.ToUInt64(reader["trans"], 16);
                                tilesetWidth = Convert.ToUInt16(reader["width"]);
                                tilesetHeight = Convert.ToUInt16(reader["height"]);

                                // Adding the tileset and image information to the dictionary:
                                artManager.tilesetList.addTilesetToLoad( ref tilesetName, ref tilesetOffset, ref tileWidth, ref tileHeight, ref tilesetWidth, ref tilesetHeight, ref trans );

                                break; // End tileset case.
                            #endregion

                            #region Layer Case
                            case "layer":

                                #region Initalizing variables

                                // Initializing variables:
                                currentMap.layerNumber += 1;
                                tempLayerNumber = currentMap.layerNumber;
                                column = 0;
                                row = 0;
                                tileWidth = Globals.tileSize;

                                #endregion

                                switch( reader["name"] )
                                { // Start Layer validation switch.

                                    #region case List for layers (1 case per map layer)
                                    case "Ground Layer 1":
                                    case "Ground Layer 2":
                                    case "Impassable Layer":
                                    case "Upper Layer":
                                    case "Roof Layer":
                                    case "Sky Layer 1":
                                    case "Sky Layer 2":
                                    #endregion

                                    // Getting the height of this layer:
                                    layerHeight = Convert.ToUInt16( reader["height"] );

                                    while ( row < layerHeight - 0 )
                                    { // Start layer while.

                                        reader.ReadToFollowing("tile");
                                        tempTileGID = Convert.ToInt32( reader["gid"] );

                                        #region Start Layer 2 ( Collision Layer ) If.
                                        if (tempLayerNumber == 2)
                                        { // Start layer 2 if.

                                            switch (tempTileGID)
                                            { // Start tempTileGID switch.

                                                #region Do nothing (0)
                                                case 0:

                                                    break;
                                                #endregion

                                                #region Grass ( 264 )
                                                case 264:

                                                    assistManager.addGrass(new Vector2(column * tileWidth, row * tileWidth));
                                                    currentMap.Rows[row].Columns[column].layerList[tempLayerNumber] = tempTileGID;

                                                    break;
                                                #endregion

                                                #region Cut Grass ( 265 )
                                                case 265:

                                                    assistManager.addCutGrass(new Vector2(column * tileWidth, row * tileWidth));
                                                    currentMap.Rows[row].Columns[column].layerList[tempLayerNumber] = tempTileGID;

                                                    break;
                                                #endregion

                                                #region Water Cases

                                                #region Water - ShoreTop1 ( 942 )
                                                case 942:

                                                    animationManager.addWaterToRunning( "ShoreTop1", "ShoreTop1", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShoreTop2 ( 943 )
                                                case 943:

                                                    animationManager.addWaterToRunning( "ShoreTop2", "ShoreTop2", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShallowLeft ( 944 )
                                                case 944:

                                                    animationManager.addWaterToRunning( "ShallowLeft", "ShallowLeft", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShallowTop ( 945 )
                                                case 945:

                                                    animationManager.addWaterToRunning( "ShallowTop", "ShallowTop", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShallowRight ( 946 )
                                                case 946:

                                                    animationManager.addWaterToRunning( "ShallowRight", "ShallowRight", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShoreAngleLeft1 ( 975 )
                                                case 975:

                                                    animationManager.addWaterToRunning( "ShoreAngleLeft1", "ShoreAngleLeft1", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShoreAngleLeft2 ( 976 )
                                                case 976:

                                                    animationManager.addWaterToRunning( "ShoreAngleLeft2", "ShoreAngleLeft2", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShoreAngleAngleRight1 ( 974 )
                                                case 974:

                                                    animationManager.addWaterToRunning( "ShoreAngleAngleRight1", "ShoreAngleAngleRight1", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShoreAngleAngleRight2 ( 977 )
                                                case 977:

                                                    animationManager.addWaterToRunning( "ShoreAngleAngleRight2", "ShoreAngleAngleRight2", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShoreRight ( 978 )
                                                case 978:

                                                    animationManager.addWaterToRunning( "ShoreRight", "ShoreRight", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - ShoreLeft ( 1016 )
                                                case 1016:

                                                    animationManager.addWaterToRunning( "ShoreLeft", "ShoreLeft", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - Deep1 ( 1017 )
                                                case 1017:

                                                    animationManager.addWaterToRunning( "Deep1", "Deep1", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - Deep2 ( 1018 )
                                                case 1018:

                                                    animationManager.addWaterToRunning( "Deep2", "Deep2", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - Deep3 ( 1019 )
                                                case 1019:

                                                    animationManager.addWaterToRunning( "Deep3", "Deep3", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - Deepst1 ( 1020 )
                                                case 1020:

                                                    animationManager.addWaterToRunning( "Deepst1", "Deepst1", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #region Water - Deepst2 ( 1021 )
                                                case 1021:

                                                    animationManager.addWaterToRunning( "Deepst2", "Deepst2", false, false, false, new Vector2( column * tileWidth, row * tileWidth ), true, true, 0, true, 1, false );
                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = 266;

                                                    break;
                                                #endregion

                                                #endregion

                                                #region Evrything else
                                                default:

                                                    currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = tempTileGID;

                                                    break;
                                                #endregion

                                            } // End tempTileGID switch.
                                        } // End layer 2 if.
                                        #endregion
                                        else
                                        { // Start not layer 2 else.

                                            currentMap.Rows[ row ].Columns[ column ].layerList[ tempLayerNumber ] = tempTileGID;

                                        } // End not layer 2 else.

                                        column++; // Increasing the column position.

                                        if ( column > tempMapWidth ) // Checking to see if we have exceeded the total number of columns.
                                        {
                                            column = 0; // Reseting column count.
                                            row++; // Moving to the next row.
                                        }
                                    } // End layer while.

                                    break; // End of layer case's.

                                } // End Layer validation switch.

                                break; // End layer case.
                            #endregion

                            #region Object Case
                            case "object":

                                switch( reader[ "type" ] )
                                { // Start reader type case.

                                    #region Object Loading

                                    #region Object Type case List (1 case for each object):
                                    case "Object":
                                    case "Readable":
                                    case "Destroyable":
                                    case "Switch":
                                    case "Container":
                                    case "Grass":
                                    case "Decoration":
                                    #endregion

                                        #region Initalizing variables:

                                        // Basic object data:
                                            tempName = "";
                                            tempType = "";
                                            tempPosition = Vector2.Zero;
                                            tempWidth = 0;
                                            tempHeight = 0;

                                        // Other Object Data:
                                            tempActivatable = "";
                                            tempConvoIndex = "";
                                            tempDestroyedTileID = 0;
                                            tempDraw = true;
                                            tempEmptyTileID = 0;
                                            tempGlow = false;
                                            tempHighlightAble = true;
                                            tempCollidable = true;
                                            tempHP = 1.0f;
                                            tempIsDestroyed = false;
                                            tempIsFull = false;
                                            tempIsOpen = false;
                                            tempLayer = 0;
                                            tempMovable = false;
                                            tempOpenTileID = 0;
                                            tempThrowable = false;
                                            tempTileID = 0;
                                            tempTileset = "";

                                        #endregion

                                        // Reading generic object information:
                                        tempName = reader[ "name" ];
                                        tempType = reader[ "type" ];
                                        tempPosition.X = float.Parse( reader[ "x" ]);
                                        tempPosition.Y = float.Parse( reader[ "y" ]);
                                        tempWidth = Convert.ToUInt16( reader[ "width" ]);
                                        tempHeight = Convert.ToUInt16( reader[ "height" ]);

                                        // Reading the "activatable" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempActivatable = reader["value"];
                                        }

                                        // Reading the collidable element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute( "collidable" );
                                        if ( reader["value"] == "False" || reader["value"] == "false")
                                        {
                                            tempCollidable = false;
                                        }

                                        // Reading the "convoIndex" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempConvoIndex = reader["value"];
                                        }

                                        // Reading the "destroyedTileID"
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempDestroyedTileID = Convert.ToUInt16( reader[ "value" ]);
                                        }

                                        // Reading the draw element:
                                        reader.ReadToFollowing( "property" );
                                        reader.MoveToAttribute( "draw" );
                                        if ( reader[ "value" ] == "False" || reader[ "value" ] == "false" )
                                        {
                                            tempDraw = false;
                                        }

                                        // Reading the "emptyTileID"
                                        reader.ReadToFollowing( "property" );
                                        if (reader["value"] != "")
                                        {
                                            tempEmptyTileID = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the Glow element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("glow");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempGlow = true;
                                        }

                                        // Reading the HighlightAble element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("highlightAble");
                                        if ( reader["value"] == "False" || reader["value"] == "false" )
                                        {
                                            tempHighlightAble = false;
                                        }

                                        // Reading the "hp" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempHP = float.Parse(reader["value"]);
                                        }

                                        // Reading the isDestroyed" element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("isDestroyed");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempIsDestroyed = true;
                                        }

                                        // Reading the isFull element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("isFull");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempIsFull = true;
                                        }

                                        // Reading the isOpen element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("isOpen");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempIsOpen = true;
                                        }

                                        // Reading the "layer" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempLayer = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the Movable element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("movable");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempMovable = true;
                                        }

                                        // Reading the "openTileID" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempOpenTileID = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the throwable element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("throwable");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempThrowable = true;
                                        }

                                        // Reading the "tileID" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempTileID = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the "tileset" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempTileset = reader["value"];
                                        }

                                        //Adding the Destructible to the list:
                                        if (player2 == null)
                                        {
                                           assistManager.addObject( ref tempName, ref tempType, ref tempPosition, ref tempWidth, ref tempHeight, ref tempConvoIndex, ref tempDestroyedTileID, ref tempEmptyTileID, ref tempGlow, ref tempHighlightAble, ref tempCollidable, ref tempHP, ref tempIsDestroyed, ref tempIsFull, ref tempIsOpen, ref tempMovable, ref tempOpenTileID, ref tempThrowable, ref tempTileID, ref tempTileset, ref tempActivatable, ref tempDraw, ref tempLayer, ref player1);
                                        }
                                        else
                                        {
                                            assistManager.addObject( ref tempName, ref tempType, ref tempPosition, ref tempWidth, ref tempHeight, ref tempConvoIndex, ref tempDestroyedTileID, ref tempEmptyTileID, ref tempGlow, ref tempHighlightAble, ref tempCollidable, ref tempHP, ref tempIsDestroyed, ref tempIsFull, ref tempIsOpen, ref tempMovable, ref tempOpenTileID, ref tempThrowable, ref tempTileID, ref tempTileset, ref tempActivatable, ref tempDraw, ref tempLayer, ref player1, ref player2);

                                        }

                                        break;
                                    #endregion

                                    #region Starting Point
                                        case "Starting Point":

                                            #region Initalizing variables:

                                            // Temp data to reduce function calls:
                                            screenOffset = camera.screenOffset;

                                            #endregion

                                            // Reading the players starting points:
                                            if( reader[ "name" ] == "P1" )
                                            { // Start P1 starting point if.

                                                //currentMap.playerOneStart = new Vector2( float.Parse( reader["x"] ) + screenOffset.X, float.Parse( reader[ "y" ]) + screenOffset.Y );
                                                currentMap.playerOneStart = new Vector2( float.Parse( reader["x"] ), float.Parse( reader[ "y" ] ) );

                                            } // End P1 starting point if.
                                            else if( player2 != null && reader[ "name" ] == "P2" )
                                            { // Start P2 starting point else if.

                                                //currentMap.playerTwoStart = new Vector2( float.Parse( reader["x"] ) + screenOffset.X, float.Parse( reader[ "y" ] ) + screenOffset.Y );
                                                currentMap.playerTwoStart = new Vector2( float.Parse( reader["x"] ), float.Parse( reader[ "y" ] ) );

                                            } // End P2 starting point else if.

                                            break;
                                    #endregion

                                    #region Activatable

                                    case "Activatable":

                                        #region Initalizing variables:

                                        // Basic object data:
                                        tempName = "";
                                        tempType = "";
                                        tempPosition = Vector2.Zero;
                                        tempWidth = 0;
                                        tempHeight = 0;

                                        // Other Object Data:
                                        tempDraw = true;
                                        tempGlow = false;
                                        tempHighlightAble = false;
                                        tempTileID = 0;
                                        tempTileset = "";

                                        // Actavatable specific data:
                                        tempSlideEnd = Vector2.Zero;
                                        tempSlideTime = 0.0f;

                                        // Temp data to reduce function calls:
                                        currentMapTileHeight = currentMap.mapTileHeight;
                                        screenOffset = camera.screenOffset;

                                        #endregion

                                        // Reading generic object information:
                                        tempName = reader["name"];
                                        tempPosition.X = float.Parse(reader["x"]);
                                        tempPosition.Y = float.Parse(reader["y"]);
                                        tempWidth = Convert.ToUInt16(reader["width"]);
                                        tempHeight = Convert.ToUInt16(reader["height"]);

                                        // Reading the "tempType" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempType = reader["value"];
                                        }

                                        // Reading the draw element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("draw");
                                        if ( reader["value"] == "False" || reader["value"] == "false" )
                                        {
                                            tempDraw = false;
                                        }

                                        // Reading the Glow element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("glow");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempGlow = true;
                                        }
                                        else
                                        {
                                            tempGlow = false;
                                        }

                                        // Reading the HighlightAble element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("highlightAble");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempHighlightAble = true;
                                        }

                                        // Reading the "Slide End X" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            //tempSlideEnd.X = ( ( float.Parse(reader["value"]) * currentMapTileHeight ) + screenOffset.X );
                                            tempSlideEnd.X = ( (float.Parse(reader["value"]) * currentMapTileHeight) );
                                        }

                                        // Reading the "Slide End Y" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            //tempSlideEnd.Y = ( ( float.Parse(reader["value"]) * currentMapTileHeight ) + screenOffset.Y );
                                            tempSlideEnd.Y = (( float.Parse( reader["value"] ) * currentMapTileHeight) );
                                        }

                                        // Reading the "Slide Time" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempSlideTime = (float.Parse(reader["value"]) );
                                        }

                                        // Reading the "tileID" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempTileID = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the "tileset" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempTileset = reader["value"];
                                        }

                                        // Adding the Actavatable to the list:
                                        if ( player2 == null )
                                        {
                                            assistManager.addActivatable( ref tempName, ref tempType, ref tempPosition, ref tempWidth,
                                                ref tempHeight, ref tempHighlightAble, ref tempGlow, ref tempSlideTime,
                                                ref tempSlideEnd, ref tempTileset, ref tempTileID,
                                                player1 );

                                        }
                                        else
                                        {
                                            assistManager.addActivatable( ref tempName, ref tempType, ref tempPosition, ref tempWidth,
                                                ref tempHeight, ref tempHighlightAble, ref tempGlow, ref tempSlideTime,
                                                ref tempSlideEnd, ref tempTileset, ref tempTileID, player1, player2 );

                                        }

                                        break;
                                    #endregion Activatable

                                    #region Animation

                                    case "Animation":

                                        #region Initalizing variables:

                                        // Basic object data:
                                        tempName = "";
                                        tempType = "";
                                        tempPosition = Vector2.Zero;

                                        // Other Object Data:
                                        tempDraw = true;
                                        tempGlow = false;
                                        tempHighlightAble = false;
                                        tempCollidable = true;
                                        tempLayer = 0;
                                        tempTileset = "";

                                        // Animation specific data:
                                        tempReverse = false;
                                        tempRunning = false;
                                        tempContinuous = false;
                                        tempPlayCountMax = 0;

                                        // Temp data to reduce function calls:
                                        screenOffset = camera.screenOffset;

                                        #endregion

                                        // Reading generic object information:
                                        tempName = reader["name"];
                                        tempPosition.X = float.Parse( reader["x"] );
                                        tempPosition.Y = float.Parse( reader["y"] );

                                        // Reading the "Type" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempType = reader["value"];
                                        }

                                        // Reading the collidable element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("collidable");
                                        if (reader["value"] == "False" || reader["value"] == "false")
                                        {
                                            tempCollidable = false;
                                        }

                                        // Reading the continuous element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("continuous");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempContinuous = true;
                                        }

                                        // Reading the draw element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("draw");
                                        if ( reader["value"] == "False" || reader["value"] == "false" )
                                        {
                                            tempDraw = false;
                                        }

                                        // Reading the Glow element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("glow");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempGlow = true;
                                        }

                                        // Reading the HighlightAble element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("highlightAble");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempHighlightAble = true;
                                        }

                                        // Reading the "layer" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempLayer = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the "playCountMax" element:
                                        reader.ReadToFollowing("property");
                                        if ( reader["value"] != "" )
                                        {
                                            tempPlayCountMax = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the reverse element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("continuous");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempReverse = true;
                                        }

                                        // Reading the running element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("running");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempRunning = true;
                                        }

                                        // Reading the "tileset" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempTileset = reader["value"];
                                        }

                                        // Adding the new animation:
                                        animationManager.addAnimationToRunning( ref tempType, ref tempName, ref tempGlow, ref tempHighlightAble, tempCollidable, ref tempPosition, ref tempRunning, ref tempContinuous, ref tempPlayCountMax, ref tempLayer, ref tempDraw, ref tempReverse );

                                        break;
                                    #endregion Animation

                                    #region Doors

                                    case "Door":

                                        #region Initalizing variables:

                                        // Basic object data:
                                        tempName = "";
                                        tempType = "";
                                        tempPosition = Vector2.Zero;

                                        // Other Object Data:
                                        tempDraw = true;
                                        tempExitPosition = Vector2.Zero;
                                        tempExitDirection = "";
                                        tempNextRoomSize = Vector2.Zero;
                                        tempNextRoomStart = Vector2.Zero;
                                        tempGlow = false;
                                        tempHighlightAble = false;
                                        tempHP = 1.0f;
                                        tempIsOpen = false;
                                        tempLayer = 0;
                                        tempNextMap = "";
                                        tempTileset = "";
                                        tempTileID = 0;
                                        tempReverse = false;
                                        tempAutoOpen = false;

                                        // Temp data to reduce function calls:
                                        screenOffset = camera.screenOffset;

                                        // Door Specific data:
                                        tempKey = "";

                                        #endregion

                                        // Reading generic object information:
                                        tempName = reader["name"];
                                        tempPosition.X = float.Parse(reader["x"]);
                                        tempPosition.Y = float.Parse(reader["y"]);

                                        // Reading the "Type" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempType = reader["value"];
                                        }

                                        // Reading the draw element:
                                        reader.ReadToFollowing( "property" );
                                        reader.MoveToAttribute( "draw" );
                                        if ( reader[ "value" ] == "True" || reader[ "value" ] == "true" )
                                        {
                                            tempAutoOpen = true;
                                        }

                                        // Reading the draw element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("draw");
                                        if ( reader["value"] == "False" || reader["value"] == "false" )
                                        {
                                            tempDraw = false;
                                        }

                                        // Reading the "exitDirection" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempExitDirection = reader["value"];
                                        }

                                        // Reading the "Exit X" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempExitPosition.X = ( float.Parse(reader["value"]) * currentMapTileHeight );
                                        }

                                        // Reading the "Exit Y" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempExitPosition.Y = ( float.Parse(reader["value"]) * currentMapTileHeight );
                                        }

                                        // Reading the Glow element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("glow");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempGlow = true;
                                        }

                                        // Reading the HighlightAble element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("highlightAble");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempHighlightAble = true;
                                        }

                                        // Reading the "hp" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempHP = float.Parse(reader["value"]);
                                        }

                                        // Reading the isOpen element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("isOpen");
                                        if ( reader["value"] == "True" || reader["value"] == "true" )
                                        {
                                            tempIsOpen = true;
                                        }

                                        // Reading the "key" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempKey = reader["value"];
                                        }

                                        // Reading the "layer" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempLayer = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the "nextMap" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempNextMap = reader["value"];
                                        }

                                        // Reading the "roomSizeX" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempNextRoomSize.X = ( float.Parse(reader["value"]) * currentMapTileHeight );
                                        }

                                        // Reading the "roomSizeY" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempNextRoomSize.Y = ( float.Parse(reader["value"]) * currentMapTileHeight );
                                        }

                                        // Reading the "roomStartX" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempNextRoomStart.X = (float.Parse(reader["value"]) * currentMapTileHeight);
                                        }

                                        // Reading the "roomStartY" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempNextRoomStart.Y = (float.Parse(reader["value"]) * currentMapTileHeight);
                                        }

                                        // Reading the "tileID" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempTileID = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the "tileset" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempTileset = reader["value"];
                                        }

                                        doorManager.addDoor( ref collision, ref tempName, ref tempType, ref tempAutoOpen, ref tempTileID, ref tempPosition, ref tempIsOpen, ref tempKey, ref tempGlow, ref tempHighlightAble, ref tempHP, ref tempTileset, ref tempDraw, ref tempLayer, ref tempNextMap, ref tempExitPosition, ref tempExitDirection, ref tempNextRoomStart, ref tempNextRoomSize, ref player1 );

                                        break;

                                    #endregion

                                    #region NPC

                                    case "NPC":

                                        #region Initalizing variables:

                                        // Basic object data:
                                        tempName = "";
                                        tempType = "";
                                        tempPosition = Vector2.Zero;

                                        // Other Object Data:
                                        tempConvoIndex = "";
                                        tempHP = 1.0f;

                                        // NPC specific data:
                                        tempAge = 0;
                                        tempMale = true;
                                        tempWalkSpeed = 200.0f;
                                        tempRunSpeed = 350.0f;

                                        // Temp data to reduce function calls:
                                        screenOffset = camera.screenOffset;

                                        #endregion

                                        // Reading generic object information:
                                        tempName = reader["name"];
                                        tempPosition.X = float.Parse(reader["x"]);
                                        tempPosition.Y = float.Parse(reader["y"]);

                                        // Reading the "Type" element:
                                        reader.ReadToFollowing( "property" );
                                        if (reader[ "value" ] != "" )
                                        {
                                            tempType = reader[ "value" ];
                                        }

                                        // Reading the "age" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempAge = Convert.ToUInt16(reader["value"]);
                                        }

                                        // Reading the "convoIndex" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempConvoIndex = reader["value"];
                                        }

                                        // Reading the "hp" element:
                                        reader.ReadToFollowing("property");
                                        if (reader["value"] != "")
                                        {
                                            tempHP = float.Parse(reader["value"]);
                                        }

                                        // Reading the male element:
                                        reader.ReadToFollowing("property");
                                        reader.MoveToAttribute("male");
                                        if ( reader["value"] == "False" || reader["value"] == "false" )
                                        {
                                            tempMale = false;
                                        }

                                        // Reading the "runSpeed" element:
                                        reader.ReadToFollowing("property");
                                        if ( reader["value"] != "" )
                                        {
                                            tempRunSpeed = float.Parse(reader["value"]);
                                        }

                                        // Reading the "walkSpeed" element:
                                        reader.ReadToFollowing("property");
                                        if ( reader["value"] != "" )
                                        {
                                            tempWalkSpeed = float.Parse(reader["value"]);
                                        }

                                        // Adding the new NPC:
                                        npcManager.addNPC( tempType, tempName, tempAge, tempMale, tempHP, tempConvoIndex, tempWalkSpeed, tempRunSpeed, tempPosition );

                                        break;

                                    #endregion

                                    #region Collision Object

                                    case "CollisionObject":

                                        #region Initalizing variables:

                                        // Basic object data:
                                        tempName = "";
                                        tempPosition = Vector2.Zero;
                                        tempWidth = 0;
                                        tempHeight = 0;

                                        // Temp data to reduce function calls:
                                        screenOffset = camera.screenOffset;

                                        #endregion

                                        // Reading generic collision object information:
                                        tempName = reader["name"];
                                        tempPosition.X = float.Parse(reader["x"]);
                                        tempPosition.Y = float.Parse(reader["y"]);
                                        tempWidth = Convert.ToUInt16(reader["width"]);
                                        tempHeight = Convert.ToUInt16(reader["height"]);

                                        // Adding the new NPC:
                                        assistManager.addCollisionObject( ref tempName, ref tempPosition, ref tempWidth, ref tempHeight, ref player1 );

                                        break;

                                    #endregion

                                } // End reader type case.

                                break; // End object group

                            #endregion

                        } // End reader.name switch.
                    } // End IsStartElement if.
                } // End read file while.
        }
コード例 #35
0
ファイル: LogicTest.cs プロジェクト: nickplus11/KeepWorking
        public void TestCreationTimer()
        {
            TimerManager tm = new TimerManager();

            tm.CreateTimer("Timer");
        }
コード例 #36
0
ファイル: LoadMap.cs プロジェクト: ericamccowan/ILS
        // Loading map with two player references:
        public void loadNewMap( ref AssistManager assistManager, ref AnimationManager animationManager, ref ArtManager artManager, ref DoorManager doorManager, ref Map currentMap, ref World world, ref Camera camera, ref Collision collision, ref TimerManager timerManager, ref NPCManager npcManager, ref Player player1, ref Player player2 )
        {
            // Start loadNewMap.

            // Getting the nextRoom/Map data then wiping it:
            string mapToLoad = world.nextMap;
            Vector2 nextRoomSize = world.nextRoomSize;
            Vector2 nextRoomStart = world.nextRoomStart;
            Vector2 exitPosition = world.nextExitPosition;
            bool localMultiplayer = Game1.Instance.LocalMultiplayer;
            world.resetNextMapData();

            // Resetting major classes:
            camera = new Camera();
            currentMap = new Map( );
            camera.resetSingletonData();
            collision = new Collision();

            player1.spriteAnimation.resetSingletonReferences(); // Reseting the draw variables (IE camera) for the player.
            if ( localMultiplayer )
            {
                player2.spriteAnimation.resetSingletonReferences();
            }

            animationManager = new AnimationManager( );
            artManager.tilesetList = new TilesetList();
            doorManager = new DoorManager();

            // Checking if we should initalize the asset manager with more than one player.
            if ( localMultiplayer )
            {
                assistManager = new AssistManager( ref player1, ref player2 );
            }
            else
            {
                assistManager = new AssistManager( ref player1 );
            }

            assistManager.initalizeSingletonData();
            npcManager = new NPCManager();

            // Reloading data:
            tmxLoading( ref mapToLoad, ref nextRoomSize, ref nextRoomStart, ref currentMap, ref camera, ref collision, ref assistManager, ref animationManager, ref doorManager, ref timerManager, ref npcManager, ref player1, ref player2 );
            artManager.tilesetList.loadAll( );

            // Reseting the starting position if need be:
            if ( exitPosition != Vector2.Zero )
            { // Start Exit Position if.

                // Adding the screenoffset to the position since it was not calculated when the exit position was read in.
                //player1.spriteAnimation.position = exitPosition + camera.screenOffset;
                player1.spriteAnimation.position = exitPosition;

                if ( localMultiplayer )
                {
                    //player2.spriteAnimation.position = exitPosition + camera.screenOffset;
                    player2.spriteAnimation.position = exitPosition;
                }

            } // Start Exit Position if.
            else
            { // Start exitPosition is zero else.

                player1.spriteAnimation.position = currentMap.playerOneStart;

                if ( localMultiplayer )
                {
                    player2.spriteAnimation.position = currentMap.playerTwoStart;
                }

            } // End exitPosition is zero else.
        }
コード例 #37
0
 public void Init()
 {
     _manager = new TimerManager(_context);
 }
コード例 #38
0
 public void OnReleaseBattleTimer(long timerId)
 {
     TimerManager.UnsetLoopTimer(timerId);//解除绑定
     Log.Trace("释放一场战斗Timer Id = " + timerId);
 }
コード例 #39
0
        public IActionResult Start()
        {
            TimerManager timerManager = new TimerManager(() => _hub.Clients.All.SendAsync("transferchartdata", DataManager.GetData()));

            return(Ok(new { Message = "Start SignalR completed" }));
        }
コード例 #40
0
 public long StartLogicalTimer(BattleTimerManager.OnBattleTimerCallBack job)
 {
     return(TimerManager.SetLoopTimer(m_gameBattleConfig.LevelTickTime, job));
 }
コード例 #41
0
        public IActionResult Get()
        {
            var timerManager = new TimerManager(() => _hub.Clients.All.SendAsync("transferchartdata", DataManager.GetData()));

            return(Ok(new { message = "Request Completed" }));
        }
コード例 #42
0
 public bool StopLogicalTimer(long id)
 {
     return(TimerManager.UnsetLoopTimer(id));
 }
コード例 #43
0
 // Use this for initialization
 void Awake()
 {
     unitychanScript = GameObject.Find("unitychan").GetComponent<UnityChanControlScriptWithRgidBody>();
     timerScript = GetComponent<TimerManager>();
     retryButton = GameObject.Find("RetryButton");
 }
コード例 #44
0
 /// <summary>
 /// 清除CDBtn
 /// </summary>
 void OnBtnClearCDUp()
 {
     MogoMessageBox.Confirm(LanguageData.GetContent(812,
                                                    PriceListData.dataMap.
                                                    Get(5).priceList[1] * Math.Ceiling(TimerManager.GetTimer(NewArenaUIViewManager.Instance.m_lblArenaUIChallengeCDNum.gameObject).GetSeconds() / 60.0f)),
                            (flag) =>
     {
         if (flag)
         {
             EventDispatcher.TriggerEvent(Events.ArenaEvent.ClearArenaCD);
         }
     });
 }
コード例 #45
0
    /// <summary>
    /// Register a new timer that should fire an event after a certain amount of time
    /// has elapsed.
    ///
    /// Registered timers are destroyed when the scene changes.
    /// </summary>
    /// <param name="duration">The time to wait before the timer should fire, in seconds.</param>
    /// <param name="onComplete">An action to fire when the timer completes.</param>
    /// <param name="onUpdate">An action that should fire each time the timer is updated. Takes the amount
    /// of time passed in seconds since the start of the timer's current loop.</param>
    /// <param name="isLooped">Whether the timer should repeat after executing.</param>
    /// <param name="useRealTime">Whether the timer uses real-time(i.e. not affected by pauses,
    /// slow/fast motion) or game-time(will be affected by pauses and slow/fast-motion).</param>
    /// <param name="autoDestroyOwner">An object to attach this timer to. After the object is destroyed,
    /// the timer will expire and not execute. This allows you to avoid annoying <see cref="NullReferenceException"/>s
    /// by preventing the timer from running and accessessing its parents' components
    /// after the parent has been destroyed.</param>
    /// <returns>A timer object that allows you to examine stats and stop/resume progress.</returns>
    public static Timer Register(float duration, Action onComplete, Action<float> onUpdate = null,
        bool isLooped = false, bool useRealTime = false, MonoBehaviour autoDestroyOwner = null)
    {
        // create a manager object to update all the timers if one does not already exist.
        if (Timer._manager == null)
        {
            TimerManager managerInScene = Object.FindObjectOfType<TimerManager>();
            if (managerInScene != null)
            {
                Timer._manager = managerInScene;
            }
            else
            {
                GameObject managerObject = new GameObject { name = "TimerManager" };
                Timer._manager = managerObject.AddComponent<TimerManager>();
            }
        }

        Timer timer = new Timer(duration, onComplete, onUpdate, isLooped, useRealTime, autoDestroyOwner);
        Timer._manager.RegisterTimer(timer);
        return timer;
    }
コード例 #46
0
 /// <summary>
 /// Crée un nouveau Timer
 /// </summary>
 /// <param name="endTime">Temps de fin du chrono</param>
 public Timer(float endTime)
 {
     TimerManager.SetupTimer(this);
     this.endTime = endTime;
 }
コード例 #47
0
        public void TestSaveLoad3()
        {
            TimerManager timerManager = new TimerManager();

            SharedStorage storage = CreateStorage("storage", timerManager);
            Assert.AreEqual(10, storage.GetInt("int", 10));
            Assert.AreEqual(3.14f, storage.GetFloat("float", 3.14f));
            Assert.AreEqual(true, storage.GetBool("bool", true));
            Assert.AreEqual("default", storage.GetString("string", "default"));
        }
コード例 #48
0
    void Start()
    {
        //Auto Hooks
        currCheckpoint = GameObject.Find("startCP");
        player = FindObjectOfType<MasterController>();
        healthManager = FindObjectOfType<HealthManager>();
        respawnManager = FindObjectOfType<RespawnManager>();
        timerManager = FindObjectOfType<TimerManager>();

        //Game Data
        GameOptionData.currentLevel = Application.loadedLevel;

        //Camera Effects
        mainCamera = FindObjectOfType<Camera>();
        cameraSize = mainCamera.orthographicSize;
        zoomOutDuration = playerRespawnDelay * 0.35f;
        zoomInDuration = playerRespawnDelay;
        if(Application.loadedLevel == 7)
        {
            defaultCameraSize = 7.0f;
        }
        else
        {
            defaultCameraSize = mainCamera.orthographicSize;
        }

        cameraZoomInEffect = false;
        cameraZoomOutEffect = false;

        //Optional HUD Information
        //Enemy Count, XP Gems Remaining
        //levelXPGems = GameObject.FindGameObjectsWithTag("XP Gem");
        //arraySize = GameObject.FindObjectsOfType<EnemyHealthManager>().Length;
        //enemyPositionArray = new Vector3[arraySize];
    }
コード例 #49
0
        private SharedStorage CreateStorage(String filename, TimerManager manager, bool clear = true)
        {
            if (clear && File.Exists(filename))
                File.Delete(filename);

            return new SharedStorage(filename, manager);
        }
コード例 #50
0
 public void Register(TimerManager time)
 {
     time.Timer += SirenMsg;
 }
コード例 #51
0
 public void SetWatchOutInNoCaptureState()
 {
     ResetData();
     TimerManager.SetTimer(this, (int)EN_TimeId.EN_ENTITYSEARCH, 1f);
 }
コード例 #52
0
ファイル: TimerManager.cs プロジェクト: lfwelove/lbp
 void Awake()
 {
     instance = this;
 }
コード例 #53
0
 public void UnRegister(TimerManager time)
 {
     time.Timer -= AlarmClockMsg;
 }
コード例 #54
0
 public override void release()
 {
     TimerManager.KillTimer(this, (int)EN_TimeId.EN_ENTITYSEARCH);
     m_listAroundPlayer.Clear();
 }
コード例 #55
0
 public void UnRegister(TimerManager time)
 {
     time.Timer -= SirenMsg;
     
     Console.WriteLine("Siren Message");
 }
コード例 #56
0
 private void OnModifyBtnClick()
 {
     TimerManager.KillTimer(this, 0);
     SwitchSubView(true);
 }
コード例 #57
0
 public PlayerList(TimerManager timerManager, int capacity)
 {
     m_timerManager = timerManager;
     m_list = new List<Player>(capacity);
 }
コード例 #58
0
 private void Start()
 {
     timerManager = FindObjectOfType <TimerManager>();
     gm           = FindObjectOfType <GameManager>();
 }
コード例 #59
0
        public void Initialize(IFileSystem fileSystem, IPathResolver resolver, IScriptRuntimeListener listener, IAsyncManager asyncManager, IScriptLogger logger, IO.IByteBufferAllocator byteBufferAllocator)
        {
            if (fileSystem == null)
            {
                throw new NullReferenceException(nameof(fileSystem));
            }

            MethodInfo bindAll = null;

            if (!isWorker)
            {
                if (listener == null)
                {
                    throw new NullReferenceException(nameof(listener));
                }

                bindAll = typeof(Values).GetMethod("BindAll", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
                if (bindAll == null)
                {
#if UNITY_EDITOR
                    var throwError = true;
                    foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                    {
                        var UnityHelper = assembly.GetType("QuickJS.Unity.UnityHelper");
                        if (UnityHelper != null)
                        {
                            var IsReflectBindingSupported = UnityHelper.GetMethod("IsReflectBindingSupported");
                            if (IsReflectBindingSupported != null)
                            {
                                if ((bool)IsReflectBindingSupported.Invoke(null, null))
                                {
                                    var InvokeReflectBinding = UnityHelper.GetMethod("InvokeReflectBinding");
                                    if (InvokeReflectBinding != null)
                                    {
                                        bindAll    = InvokeReflectBinding;
                                        throwError = false;
                                    }
                                }
                            }
                            break;
                        }
                    }

                    if (throwError)
                    {
                        throw new Exception("generate binding code before run");
                    }
#else
                    throw new Exception("generate binding code before run");
#endif
                }
                else
                {
                    var codeGenVersionField = typeof(Values).GetField("CodeGenVersion");
                    if (codeGenVersionField == null || !codeGenVersionField.IsStatic || !codeGenVersionField.IsLiteral || codeGenVersionField.FieldType != typeof(uint))
                    {
                        throw new Exception("binding code version mismatch");
                    }

                    var codeGenVersion = (uint)codeGenVersionField.GetValue(null);
                    if (codeGenVersion != ScriptEngine.VERSION)
                    {
                        if (logger != null)
                        {
                            logger.Write(LogLevel.Warn, "CodeGenVersion: {0} != {1}", codeGenVersion, ScriptEngine.VERSION);
                        }
                    }
                }
            }

            asyncManager.Initialize(_mainThreadId);

            _isValid   = true;
            _isRunning = true;
            // _rwlock = new ReaderWriterLockSlim();
            _rt = JSApi.JS_NewRuntime();
            JSApi.JS_SetHostPromiseRejectionTracker(_rt, JSApi.PromiseRejectionTracker, IntPtr.Zero);
#if UNITY_EDITOR
            JSApi.JS_SetInterruptHandler(_rt, _InterruptHandler, IntPtr.Zero);
#else
            if (isWorker)
            {
                JSApi.JS_SetInterruptHandler(_rt, _InterruptHandler, IntPtr.Zero);
            }
#endif
            JSApi.JS_SetRuntimeOpaque(_rt, (IntPtr)_runtimeId);
            JSApi.JS_SetModuleLoaderFunc(_rt, module_normalize, module_loader, IntPtr.Zero);
            CreateContext();
            JSApi.JS_NewClass(_rt, JSApi.JSB_GetBridgeClassID(), "CSharpClass", JSApi.class_finalizer);

            _listener            = listener;
            _pathResolver        = resolver;
            _asyncManager        = asyncManager;
            _byteBufferAllocator = byteBufferAllocator;
            _autorelease         = new Utils.AutoReleasePool();
            _fileSystem          = fileSystem;
            _logger       = logger;
            _objectCache  = new ObjectCache(_logger);
            _timerManager = new TimerManager(_logger);
            _typeDB       = new TypeDB(this, _mainContext);
            _typeDB.AddType(typeof(Unity.JSBehaviour), JSApi.JS_UNDEFINED);
#if UNITY_EDITOR
            _typeDB.AddType(typeof(Unity.JSEditorWindow), JSApi.JS_UNDEFINED);
            _typeDB.AddType(typeof(Unity.JSBehaviourInspector), JSApi.JS_UNDEFINED);
#endif
            listener.OnCreate(this);

            // await Task.Run(() => runner.OnBind(this, register));
            if (bindAll != null)
            {
                bindAll.Invoke(null, new object[] { this });
            }

            var register = new TypeRegister(_mainContext);
            listener.OnBind(this, register);
            if (!_isWorker)
            {
                JSWorker.Bind(register);
            }
            TimerManager.Bind(register);
            register.Finish();

            AddStaticModule("jsb", ScriptContext.Bind);
            FindModuleResolver <StaticModuleResolver>().Warmup(_mainContext);

            listener.OnComplete(this);
        }
コード例 #60
0
ファイル: IntroManager.cs プロジェクト: Zyow/GameJam_P3D_2015
 // Use this for initialization
 void Awake()
 {
     timerManager = FindObjectOfType<TimerManager>();
     ruleManager = FindObjectOfType<RuleManager>();
     StartCoroutine(IntroTime());
 }