Ejemplo n.º 1
0
        public void SetTimerEvent(UUID m_ID, UUID m_itemID, double sec)
        {
            if (sec == 0) // Disabling timer
            {
                RemoveScript(m_ID, m_itemID);
                return;
            }

            // Add to timer
            TimerClass ts = new TimerClass();
            ts.ID = m_ID;
            ts.itemID = m_itemID;
            ts.interval = (long)(sec * 1000);

            //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
            ts.next = Environment.TickCount + ts.interval;

            string key = MakeTimerKey(m_ID, m_itemID);
            lock (TimerListLock)
            {
                // Adds if timer doesn't exist, otherwise replaces with new timer
                Timers[key] = ts;
            }

            //Make sure that the cmd handler thread is running
            m_ScriptEngine.MaintenanceThread.PokeThreads ();
        }
Ejemplo n.º 2
0
        public void SetTimerEvent(uint m_localID, UUID m_itemID, double sec)
        {
            if (sec == 0) // Disabling timer
            {
                UnSetTimerEvents(m_localID, m_itemID);
                return;
            }

            // Add to timer
            TimerClass ts = new TimerClass();
            ts.localID = m_localID;
            ts.itemID = m_itemID;
            ts.interval = Convert.ToInt64(sec * 10000000); // How many 100 nanoseconds (ticks) should we wait
            //       2193386136332921 ticks
            //       219338613 seconds

            //ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
            ts.next = DateTime.Now.Ticks + ts.interval;

            string key = MakeTimerKey(m_localID, m_itemID);
            lock (TimerListLock)
            {
                // Adds if timer doesn't exist, otherwise replaces with new timer
                Timers[key] = ts;
            }
        }
    void Start()
    {
        moveDelay = Random.Range(1, 3);

        timerClass = new TimerClass();
        timerClass.ResetTimer(moveDelay);

        CalculatePositions();
    }
Ejemplo n.º 4
0
    private void Start()
    {
        gameData = (GameData)GameController.Instance.GameData.Data;

        timer = new TimerClass();
        timer.ResetTimer();

        Init();
    }
Ejemplo n.º 5
0
 internal bool Refresh(TimerClass alertFilter)
 {
     if (IsReady && AlertDone)
     {
         return(false);
     }                                           // No need to update or trigger alerts
     RaisePropertyChanged(nameof(RemainingTime));
     return(IsReady != AlertDone ? (AlertDone = IsReady) && ((alertFilter & Class) != TimerClass.None) : false);
 }
Ejemplo n.º 6
0
        private static LcdDisplay GetLCDDisplay()
        {
            var timer  = new TimerClass();
            var logger = new ConsoleLogger();

            var display = new LcdDisplay(timer, logger);

            return(display);
        }
Ejemplo n.º 7
0
 internal override void ChangeTimerClass(TimerClass newClass)
 {
     if ((newClass & TimerClass.Agent) == TimerClass.None)
     {
         throw new NotSupportedException("Agent state can not be changed to non-agent value");
     }
     IsRecovering = newClass == TimerClass.AgentRecovery;
     RaisePropertyChanged(nameof(Class));
 }
    int i; // it is used as number of current wave. starting number equal to -1;

    //public bool isPaused;



    void Awake()
    {
        // create a new timer
        enemyTimer = new TimerClass();

        worldVel    = Ground.worldDir * speed;
        worldAngVel = (speed / Ball.ballRadius) * Mathf.Rad2Deg;

        checkNextWaveTime = 0;
    }
Ejemplo n.º 9
0
    //method for creating record
    public void Save(int id)
    {
        TimerClass i = timerList.Where(x => x.ID == = id);

        DB.Insert(x.Type, DateTime.Now.ToString());
        Console.WriteLine("Successfuly Saved");

        // Re-start the timer
        i.Timer.Start();
    }
Ejemplo n.º 10
0
    // Constructor for the class.
    internal AnotherEventTestClass(TimerClass timer)
    {
        // Obtain a reference to the Timer class.
        _tc = timer;

        // Subscribe to the event in the Timer class providing
        // the handler method that will be called when the Timer
        // class raises the event.
        _tc.OnAdvanceTimer += new TimerClass.AdvanceTimerHandler (DisplayMessageHandler);
    }
Ejemplo n.º 11
0
        public void TestWorkerThreadsAdd()
        {
            int        maxThreads = 10;
            TimerClass mc         = new TimerClass();

            mc.WorkingThreads = new TimerClass.WorkerThreads(maxThreads);
            mc.WorkingThreads.add(new BackgroundWorker());

            int remainingThreads = mc.WorkingThreads.remainingThreads();

            Assert.IsTrue(remainingThreads == maxThreads - 1);
        }
Ejemplo n.º 12
0
        public bool PreInit(IntPtr WindowHandle)
        {
            D3D = new DirectX11Class();
            if (!D3D.Init(WindowHandle))
            {
                MessageBox.Show("Failed to initialize DirectX11!");
                return(false);
            }

            Timer = new TimerClass();
            FPS   = new FPSClass();

            Timer.Init();
            FPS.Init();

            RenderStorageSingleton.Instance.Prefabs = new RenderPrefabs();
            if (!RenderStorageSingleton.Instance.ShaderManager.Init(D3D.Device))
            {
                MessageBox.Show("Failed to initialize Shader Manager!");
                return(false);
            }
            //this is backup!
            RenderStorageSingleton.Instance.TextureCache.Add(0, TextureLoader.LoadTexture(D3D.Device, D3D.DeviceContext, "texture.dds"));

            var structure = new M2TStructure();
            //import gizmo
            RenderModel model = new RenderModel();

            structure.ReadFromM2T("Resources/GizmoModel.m2t");
            model.ConvertMTKToRenderModel(structure);
            model.InitBuffers(D3D.Device, D3D.DeviceContext);
            model.DoRender = false;

            RenderModel sky = new RenderModel();

            structure = new M2TStructure();
            structure.ReadFromM2T("Resources/sky_backdrop.m2t");
            sky.ConvertMTKToRenderModel(structure);
            sky.InitBuffers(D3D.Device, D3D.DeviceContext);
            sky.DoRender = false;
            Assets.Add(1, sky);

            RenderModel clouds = new RenderModel();

            structure = new M2TStructure();
            structure.ReadFromM2T("Resources/weather_clouds.m2t");
            clouds.ConvertMTKToRenderModel(structure);
            clouds.InitBuffers(D3D.Device, D3D.DeviceContext);
            clouds.DoRender = false;
            Assets.Add(2, clouds);
            return(true);
        }
Ejemplo n.º 13
0
Archivo: bomb.cs Proyecto: CptMedo/Mars
    void Start()
    {
        thisLight = GameObject.Find("2DLight").GetComponent<DynamicLight>();
        player = GameObject.Find("MartinHead");

        timer = gameObject.AddComponent<TimerClass>();

        // Subscribe timer events //
        timer.OnUpdateTimerEvent += timerUpdate;
        timer.OnTargetTimerEvent += tick;

        timer.InitTimer(1f, true);
    }
Ejemplo n.º 14
0
    // Constructor for the class.
    internal EventsTestClass(TimerClass timer)
    {
        // Obtain a reference to the Timer class.
        _tc = timer;

        // Subscribe to the event in the Timer class and
        // provide it the handler that will be called when
        // the TimerClass raises the event. Note that if
        // you change the operator from '+=' to just '=',
        // the compiler will generate an error. This shows
        // that the event keyword enforces the use of the
        // appropriate operator.
        _tc.OnAdvanceTimer += new TimerClass.AdvanceTimerHandler (DisplayLetterHandler);
    }
Ejemplo n.º 15
0
        public void TestMaxThreadedJobs()
        {
            if (_offline)
            {
                return;
            }

            int      numOfJobs = int.Parse(EPMLiveCore.CoreFunctions.getFarmSetting("QueueThreads"));;
            DateTime dtStart   = DateTime.Now;

            //insert test queue and job into DB with the max number of threads
            for (int i = 0; i < numOfJobs; i++)
            {
                InsertTestJob();
            }

            using (var conn = new SqlConnection(_connStr))
            {
                conn.Open();

                TimerClass mc = new TimerClass();
                if (mc.startTimer())
                {
                    mc.runTimer();

                    int failedTrial  = 0;
                    int notProcessed = 0;

                    SqlCommand cmd = null;
                    //loop till job is processed
                    do
                    {
                        Thread.Sleep(1000);

                        cmd = new SqlCommand(
                            "select count(*) from Queue where status < 2 and dtcreated >= @Created", conn);

                        cmd.Parameters.AddWithValue("@Created", dtStart);

                        notProcessed = int.Parse(cmd.ExecuteScalar().ToString());
                    } while (notProcessed > 0 && failedTrial++ < numOfJobs);

                    Assert.IsTrue(notProcessed == 0, "Could not process all jobs");
                }
                else
                {
                    Assert.Fail("Start Timer failed");
                }
            }
        }
Ejemplo n.º 16
0
    void Start()
    {
        thisLight = GameObject.Find("2DLight").GetComponent <DynamicLight>();
        player    = GameObject.Find("MartinHead");

        timer = gameObject.AddComponent <TimerClass>();


        // Subscribe timer events //
        timer.OnUpdateTimerEvent += timerUpdate;
        timer.OnTargetTimerEvent += tick;

        timer.InitTimer(1.2f, true);
    }
Ejemplo n.º 17
0
        public void Shutdown()
        {
            Camera = null;
            Timer  = null;
            Light  = null;

            foreach (KeyValuePair <int, IRenderer> model in Assets)
            {
                model.Value?.Shutdown();
            }

            Assets = null;
            D3D?.Shutdown();
            D3D = null;
        }
Ejemplo n.º 18
0
        public void CreateFromData(UUID itemID, UUID objectID,
                                   OSD data)
        {
            OSDMap     save = (OSDMap)data;
            TimerClass ts   = new TimerClass();

            ts.ID       = objectID;
            ts.itemID   = itemID;
            ts.interval = (long)save["Interval"].AsReal();
            ts.next     = Environment.TickCount + (long)save["Next"].AsReal();

            lock (TimerListLock)
            {
                Timers[MakeTimerKey(objectID, itemID)] = ts;
            }
        }
Ejemplo n.º 19
0
        public void TestWorkerThreadsExceedMaximum()
        {
            int        maxThreads = 10;
            TimerClass mc         = new TimerClass();

            mc.WorkingThreads = new TimerClass.WorkerThreads(maxThreads);

            for (int i = 0; i < maxThreads + 3; i++)
            {
                mc.WorkingThreads.add(new BackgroundWorker());
            }

            int remainingThreads = mc.WorkingThreads.remainingThreads();

            Assert.IsTrue(remainingThreads == 0);
        }
Ejemplo n.º 20
0
        public void CreateFromData(uint localID, UUID itemID, UUID objectID,
                                   Object[] data)
        {
            int idx = 0;

            while (idx < data.Length)
            {
                TimerClass ts = new TimerClass();

                ts.localID  = localID;
                ts.itemID   = itemID;
                ts.interval = (long)data[idx];
                ts.next     = DateTime.Now.Ticks + (long)data[idx + 1];
                idx        += 2;

                Timers.Add(MakeTimerKey(localID, itemID), ts);
            }
        }
Ejemplo n.º 21
0
    IEnumerator Start()
    {
        thisLight = GameObject.Find("2DLight").GetComponent <DynamicLight2D.DynamicLight>();
        player    = GameObject.Find("MartinHead");

        timer = gameObject.AddComponent <TimerClass>();


        // Subscribe timer events //
        timer.OnUpdateTimerEvent += timerUpdate;
        timer.OnTargetTimerEvent += tick;

        timer.InitTimer(1.2f, true);

        StartCoroutine(LoopUpdate());

        yield return(null);
    }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            Console.Write("An application that demonstrates how the TimerEvent class works\nWaiting time in seconds: ");

            var input = Console.ReadLine();

            if (!Int32.TryParse(input, out int time))
            {
                Console.WriteLine("Invalid data");
                return;
            }
            Console.WriteLine(String.Empty);

            TimerClass timer = new TimerClass(time, "TestTimer");
            var        user  = new UserClassMethod(timer);

            user.Init();
            user.Run();
            Console.ReadLine();
        }
Ejemplo n.º 23
0
    // Start is called before the first frame update
    void Start()
    {
        targetPosition  = transform.position;
        currentPosition = transform.position;

        theLevelGenerator = GameObject.FindGameObjectWithTag("LevelGenerator").GetComponent <LevelGenerator>();
        spacingInterval   = theLevelGenerator.spacingInterval;

        theAudioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>();

        compSource  = GameObject.FindGameObjectWithTag("CompSource").GetComponent <AudioSource>();
        chordSource = GameObject.Find("ChordLow").GetComponent <AudioSource>();

        theInputManager = GameObject.Find("InputManager").GetComponent <InputManager>();


        highHatSource = GameObject.FindGameObjectWithTag("HighHatSource").GetComponent <AudioSource>();

        noteBuffer = new arrowNotes[numberOfNotesToBuffer];
        noteIndex  = 0;

        attackUp1 = new arrowNotes[] { arrowNotes.Up, arrowNotes.Left, arrowNotes.Right };
        //attackUp1 = new arrowNotes[] { arrowNotes.Up, arrowNotes.Up, arrowNotes.Up };
        attackDown2 = new arrowNotes[] { arrowNotes.Down, arrowNotes.Left, arrowNotes.Right };
        //attackDown2 = new arrowNotes[] { arrowNotes.Down, arrowNotes.Down, arrowNotes.Down };
        attackLeft3          = new arrowNotes[] { arrowNotes.Left, arrowNotes.Down, arrowNotes.Right };
        attackRight4         = new arrowNotes[] { arrowNotes.Right, arrowNotes.Down, arrowNotes.Left };
        attackSpecialFirst5  = new arrowNotes[] { arrowNotes.Right, arrowNotes.Up, arrowNotes.Left, arrowNotes.Right };
        attackSpecialSecond6 = new arrowNotes[] { arrowNotes.Right, arrowNotes.Left, arrowNotes.Right, arrowNotes.Left };
        hitTimer             = new TimerClass();

        theGameManager = GameObject.Find("GameManager").GetComponent <GameManager>();

        playerSpriteRenderer = gameObject.GetComponent <SpriteRenderer>();

        heart1   = GameObject.Find("Heart1");
        heart2   = GameObject.Find("Heart2");
        heart3   = GameObject.Find("Heart3");
        heart4   = GameObject.Find("Heart4");
        nextNote = theAudioManager.nextNoteTime;
    }
Ejemplo n.º 24
0
        public static void Init()
        {
            Squirrel = new Squirrel();
            Squirrel.SetPrintFunc(OnPrint, OnError);
            Squirrel.PushRootTable();
            Squirrel.RegisterBlobLib();
            Squirrel.RegisterIOLib();
            Squirrel.RegisterSystemLib();
            Squirrel.RegisterMathLib();
            Squirrel.RegisterStringLib();
            Squirrel.SetErrorHandlers();
            //Squirrel.EnableDebugInfo(true);

            RegisterCores();
            TimerClass.Register();

            PushCompiledFile("demo.nut");
            Squirrel.PushRootTable();
            PopToCallAsMethod(-2);
            //CallGlobal("main");
        }
Ejemplo n.º 25
0
    // Use this for initialization
    void Start()
    {
        Vector3 moveForward = new Vector3(0f, 0f, 1.0f);

        rigidbody.centerOfMass += moveForward;

        startline_hit  = false;
        startline_time = 0.0f;

        tc          = (TimerClass)ScriptableObject.CreateInstance("TimerClass");
        lapCount    = 0;
        fastestTime = 0.0f;

        averageLapTime = 0.0f;
        minLapTime     = 9999999.0f;
        maxLapTime     = 0.0f;

        tc.setAvgWindow(3);

        startline_hit  = false;
        startline_time = 61.0f;
    }
Ejemplo n.º 26
0
    // main logic
    private void InitGame()
    {
        // init nemuManager ref
        if (!menuManager)
        {
            menuManager = MenuManager_Basket.Instance;
        }

        // chack playerManager ref
        if (!playerManager)
        {
            playerManager = PlayerManager_Basket.Instance;
        }

        // init soundManager
        if (!soundManager)
        {
            soundManager = BaseSoundController.Instance;
        }

        // initialize a timer
        theTimer = ScriptableObject.CreateInstance <TimerClass>();
    }
Ejemplo n.º 27
0
        public void CreateFromData(UUID itemID, UUID objectID,
                                   OSD data)
        {
            OSDMap     save = (OSDMap)data;
            TimerClass ts   = new TimerClass {
                ID = objectID, itemID = itemID, interval = save["Interval"].AsLong()
            };

            if (ts.interval == 0) // Disabling timer
            {
                return;
            }

            ts.next = Environment.TickCount + save["Next"].AsLong();

            lock (TimerListLock)
            {
                Timers[MakeTimerKey(objectID, itemID)] = ts;
            }

            //Make sure that the cmd handler thread is running
            m_ScriptEngine.MaintenanceThread.PokeThreads(ts.itemID);
        }
Ejemplo n.º 28
0
        public void TestOldJobAlreadyWithAnotherServer()
        {
            if (_offline)
            {
                return;
            }

            //insert test queue and job into DB with job assigne to dummy server with old date
            InsertTestJob(true, true);

            TimerClass mc = new TimerClass();

            if (mc.startTimer())
            {
                mc.runTimer();

                int     failedTrial = 0;
                DataRow queue       = null;
                //loop till job is processed
                do
                {
                    Thread.Sleep(1000);
                    queue = GetQueueExecutionResult();
                } while (queue["dtfinished"] == DBNull.Value && failedTrial++ < MaxTrials * 2);

                Assert.IsTrue(failedTrial < MaxTrials, "Maximum trials exceeded");

                Assert.IsTrue(queue["queueserver"].ToString() == System.Environment.MachineName,
                              "Job not assigned properly");
                Assert.IsTrue(queue["status"].ToString() == "2", "Operation failed");
                Assert.IsTrue(queue["percentComplete"].ToString() == "100", "Operation Incomplete");
            }
            else
            {
                Assert.Fail("Start Timer failed");
            }
        }
Ejemplo n.º 29
0
        public void TestRecentJobAlreadyWithAnotherServer()
        {
            if (_offline)
            {
                return;
            }

            //insert test queue and job into DB with job assigned to dummy server
            InsertTestJob(true, false);

            TimerClass mc = new TimerClass();

            if (mc.startTimer())
            {
                mc.runTimer();

                Thread.Sleep(1000);
                using (var conn = new SqlConnection(_connStr))
                {
                    conn.Open();

                    SqlDataReader reader = null;
                    SqlCommand    cmd    = new SqlCommand(
                        "select * from Queue where status = 0 and queueuid = @queueid", conn);

                    cmd.Parameters.AddWithValue("@queueid", _queueid);
                    reader = cmd.ExecuteReader();

                    Assert.IsTrue(reader.Read(), "Job belongs to another server, processed with mistake.");
                    reader.Close();
                }
            }
            else
            {
                Assert.Fail("Start Timer failed");
            }
        }
Ejemplo n.º 30
0
        public void TestOneJob()
        {
            if (_offline)
            {
                return;
            }

            //insert test queue and job into DB
            InsertTestJob();

            TimerClass mc = new TimerClass();

            if (mc.startTimer())
            {
                mc.runTimer();

                int     failedTrial = 0;
                DataRow queue       = null;

                //loop till job is processed
                do
                {
                    Thread.Sleep(1000);
                    queue = GetQueueExecutionResult();
                } while (queue["dtfinished"] == DBNull.Value && failedTrial++ < MaxTrials);

                Assert.IsTrue(failedTrial < MaxTrials, "Maximum trials exceeded");

                Assert.IsTrue(queue["status"].ToString() == "2", "Invalid result status");
                Assert.IsTrue(queue["percentComplete"].ToString() == "100", "Invalid result percentage");
            }
            else
            {
                Assert.Fail("Start Timer failed");
            }
        }
Ejemplo n.º 31
0
        private void button32_Click(object sender, EventArgs e)
        {
            TimerClass tmr1 = new TimerClass();
            tmr1.DateAndTime = new DateTime(1996, 1, 1, 0, 0, 0);
            DateTime dt1 = new DateTime(1996, 1, 1, 0, 0, 0);
            for( int i = 0; i < 5000; i++)
            {
                //tmr1.DateAndTime = tmr1.DateAndTime.AddSeconds(1);
                dt1 = dt1.AddSeconds(5);
                CtrlProgramsOptions[1].ListEventsYear.Add(new TimerClass());
                CtrlProgramsOptions[1].ListEventsYear[i].DateAndTime = new DateTime(1996, dt1.Month, dt1.Day, dt1.Hour, dt1.Minute, dt1.Second);
            }

            UpdateAllFormElements();
        }
Ejemplo n.º 32
0
 // Mission classes are unique by ID, they should not change
 internal override void ChangeTimerClass(TimerClass newClass) => throw new NotSupportedException("Mission type is constant, and should not change");
Ejemplo n.º 33
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        //this is no longer a void type due to the need to use the yield "iterator" keyword
        protected override void LoadContent()
        {
            //sets mouse to center screen...so you don't look up
            Mouse.SetPosition(-MyScreen.FindCenterScreen().X, MyScreen.FindCenterScreen().Y);
            gameClock = new TimerClass();
            //displays initial 0%
            MyScreen.RunSplashScreen(0f,graphics);
            //person controls initialized

            MyPerson = new CollisionCheckSystem(Content.Load<Model>("HumanRectangle"), new Vector3(5.0f, 3.0f, 0.0f), Content, models, graphics);

            //Total amount of objects to be loaded in the game; populated by the data file(s) used
            TotalItems += CountModels(MyPerson.CurrentRoom);
            TotalItems += CountSongs();
            aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
            //increments loaded items
            LoadProgress();
            MouseCurrent = Mouse.GetState();
            LastState = new KeyboardState();
            //loads models in a file
            LoadNewModel(MyPerson.CurrentRoom);
            //person moves to center of the room
            MyPerson.ChangeStartPos(new Vector3(-400, 99, -250));//Door.FindCenterRoom(models.Find(Door.FindTypeOfDoor)));
            //adds all objects currently loaded to the collision check system (for the person)
            MyPerson.VisibleObjects = models;
            DataTypes.DataValues.ScreenHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;
            DataTypes.DataValues.ScreenWidth = GraphicsDevice.PresentationParameters.BackBufferWidth;
            MyPerson.Position = new Vector3(0, 10, 0);
            //--------------------------------------------------------------
            //For drawing the reticle
            //used in load content method
            spriteBatch = new SpriteBatch(GraphicsDevice);
            DataValues.Font = Content.Load<SpriteFont>(@"Fonts\Font");
            // TODO: use this.Content to load your game content here
            GameReticle = this.Content.Load<Texture2D>(FolderNames.Textures + FolderNames.Reticles + "ReticleBetter");
            LoadProgress();
            //oh and the 3 portal reticles to....to be coded later...
            PBlueReticle = this.Content.Load<Texture2D>(FolderNames.Textures + FolderNames.Reticles + "PortalBlue");
            LoadProgress();
            POrangeReticle = this.Content.Load<Texture2D>(FolderNames.Textures + FolderNames.Reticles + "PortalOrange");
            LoadProgress();
            PBothReticle = this.Content.Load<Texture2D>(FolderNames.Textures + FolderNames.Reticles + "PortalBoth");
            LoadProgress();
            PEmptyReticle = this.Content.Load<Texture2D>(FolderNames.Textures + FolderNames.Reticles + "PortalEmpty");
            ForgeObj.Initialize(spriteBatch, Content.Load<Texture2D>(@"Textures\Blank"), Content,FontColor,SelectColor,BackColor);
            LoadProgress();
            //models.Add(new Wall("Wall", "wall", Content.Load<Model>(@"Models\HighRes\wall"), new Vector3(5, 5, 5), new Vector3(0f,1.5f,.5f), GraphicsDevice, true, true, .8f, true, "Wall{Length:3;Height:1;Width:5;}"));
            //models.Add(new Wall("Wall", "wall", Content.Load<Model>(@"Models\HighRes\wall"), new Vector3(5, 5, 5), Vector3.Zero, GraphicsDevice, true, true, 3,1,5));
            //--------------------------------------------------------------
            effects = new BasicEffect(GraphicsDevice);
            LoadProgress();
            DataValues.LastState = Keyboard.GetState();
            // loads the lighting effect HLSL file Ambient.fx
            // this is what is used to light wall objects only
            LightingEffect = Content.Load<Effect>("Effects/Ambient");
            GetMusic();
            DataValues.UserPosition = MyPerson.Position;
            DataValues.HudItems = new String[] { "", "", "", "", ""}.ToList<String>();
            DataValues.Hud = new ScreenMenu(DataValues.HudItems, new Vector2(DataTypes.DataValues.ScreenWidth - 300, DataTypes.DataValues.ScreenHeight - 110), DataValues.Font, 5, 0, FontColor, FontColor, BackColor, 12, Content.Load<Texture2D>(@"Textures\Blank"));
        }
Ejemplo n.º 34
0
 internal abstract void ChangeTimerClass(TimerClass newClass);
Ejemplo n.º 35
0
        public void CreateFromData (UUID itemID, UUID objectID,
                                   OSD data)
        {
            OSDMap save = (OSDMap)data;
            TimerClass ts = new TimerClass ();

            ts.ID = objectID;
            ts.itemID = itemID;
            ts.interval = (long)save["Interval"].AsReal ();
            ts.next = Environment.TickCount + (long)save["Next"].AsReal ();

            lock (TimerListLock)
            {
                Timers[MakeTimerKey (objectID, itemID)] = ts;
            }
        }
Ejemplo n.º 36
0
        // кнопка добавление нового элемента в список праздников текущей управл. программы
        private void button2_Click(object sender, EventArgs e)
        {
            SaveDataForBack();

            TimerClass newItem = new TimerClass(new DateTime(1996, monthCalendar1.SelectionStart.Month, monthCalendar1.SelectionStart.Day), false);
            CtrlProgramsOptions[ProgSelected].ListHolidays.AddSmart(newItem, 0);

            ReDrawListOfHolidays();
        }
Ejemplo n.º 37
0
        /***********************************************************************/

        public void setTc(TimerClass tcIn)
        {
            this.tc = tcIn;
        }
Ejemplo n.º 38
0
    static void Main()
    {
        // Create a TimerClass object.
        TimerClass tc = new TimerClass();

        // Create an EventsTestClass object providing a reference to
        // the TimerClass object.
        EventsTestClass etc = new EventsTestClass(tc);

        // Create AnotherEventTestClass object and provide it the
        // same reference to the TimerClass object.
        AnotherEventTestClass aetc = new AnotherEventTestClass(tc);

        // Run the TimerClass.
        tc.Run();

        Console.Write ("\n\nPress <ENTER> to end: ");
        Console.Read();
    }
Ejemplo n.º 39
0
        public void CreateFromData(uint localID, UUID itemID, UUID objectID,
                                   Object[] data)
        {
            int idx = 0;

            while (idx < data.Length)
            {
                TimerClass ts = new TimerClass();

                ts.localID = localID;
                ts.itemID = itemID;
                ts.interval = (long)data[idx];
                ts.next = DateTime.Now.Ticks + (long)data[idx+1];
                idx += 2;

                lock (TimerListLock)
                {
                    Timers.Add(MakeTimerKey(localID, itemID), ts);
                }
            }
        }
Ejemplo n.º 40
0
 public MovingPlatform(Vector2 StartPosition, Vector2 EndPosition, float Time, Rectangle CollisionBox) : base(StartPosition, CollisionBox)
 {
     timer = new TimerClass(Time);
     start = StartPosition;
     end   = EndPosition;
 }
    void Init()
    {
        if (playerList != null)
        {
            Debug.ClearDeveloperConsole();
            Debug.Log("playerList.Count =" + playerList.Count);
            Debug.Break();
        }

        SpawnController.Instance.Restart();

        // incase we need to change the timescale, it gets set here
        Time.timeScale = gameSpeed;

        // tell battle manager to prepare for the battle
        GlobalBattleManager.Instance.InitNewBattle();

        // initialize some temporary arrays we can use to set up the players
        Vector3 []    playerStarts    = new Vector3 [numberOfBattlers];
        Quaternion [] playerRotations = new Quaternion [numberOfBattlers];

        // we are going to use the array full of start positions that must be set in the editor, which means we always need to
        // make sure that there are enough start positions for the number of players

        for (int i = 0; i < numberOfBattlers; i++)
        {
            // grab position and rotation values from start position transforms set in the inspector
            playerStarts [i]    = (Vector3)startPoints [i].position;
            playerRotations [i] = ( Quaternion )startPoints [i].rotation;
        }

        SpawnController.Instance.SetUpPlayers(playerPrefabList, playerStarts, playerRotations, playerParent, numberOfBattlers);

        playerTransforms = new ArrayList();

        // now let's grab references to each player's controller script
        playerTransforms = SpawnController.Instance.GetAllSpawnedPlayers();

        playerList = new ArrayList();

        for (int i = 0; i < numberOfBattlers; i++)
        {
            Transform        tempT          = (Transform)playerTransforms[i];
            CarController_TB tempController = tempT.GetComponent <CarController_TB>();

            playerList.Add(tempController);

            BaseAIController tempAI = tempController.GetComponent <BaseAIController>();

            tempController.Init();

            if (i > 0)
            {
                // grab a ref to the player's gameobject for later
                playerGO1 = SpawnController.Instance.GetPlayerGO(0);

                // tell AI to get the player!
                tempAI.SetChaseTarget(playerGO1.transform);

                // set AI mode to chase
                tempAI.SetAIState(AIStates.AIState.steer_to_target);
            }
        }

        // add an audio listener to the first car so that the audio is based from the car rather than the main camera
        playerGO1.AddComponent <AudioListener>();

        // look at the main camera and see if it has an audio listener attached
        AudioListener tempListener = Camera.main.GetComponent <AudioListener>();

        // if we found a listener, let's destroy it
        if (tempListener != null)
        {
            Destroy(tempListener);
        }

        // grab a reference to the focussed player's car controller script, so that we can
        // do things like access its speed variable
        thePlayerScript = ( CarController_TB )playerGO1.GetComponent <CarController_TB>();

        // assign this player the id of 0 - this is important. The id system is how we will know who is firing bullets!
        thePlayerScript.SetID(0);

        // set player control
        thePlayerScript.SetUserInput(true);

        // as this is the user, we want to focus on this for UI etc.
        focusPlayerScript = thePlayerScript;

        // tell the camera script to target this new player
        cameraScript.SetTarget(playerGO1.transform);

        // lock all the players on the spot until we're ready to go
        SetPlayerLocks(true);

        // start the game in 3 seconds from now
        Invoke("StartGame", 4);

        // initialize a timer, but we won't start it right away. It gets started in the FinishedCount() function after the count-in
        theTimer = ScriptableObject.CreateInstance <TimerClass>();

        // update positions throughout the battle, but we don't need
        // to do this every frame, so just do it every half a second instead
        InvokeRepeating("UpdatePositions", 0f, 0.5f);

        // hide our count in numbers
        HideCount();

        // schedule count in messages
        Invoke("ShowCount3", 1);
        Invoke("ShowCount2", 2);
        Invoke("ShowCount1", 3);
        Invoke("FinishedCount", 4);

        // hide final position text
        finalPositionText.gameObject.SetActive(false);
        doneFinalMessage = false;

        didInit = true;
    }
Ejemplo n.º 42
0
        public void CreateFromData(UUID itemID, UUID objectID,
                                   OSD data)
        {
            OSDMap save = (OSDMap)data;
            TimerClass ts = new TimerClass { ID = objectID, itemID = itemID, interval = save["Interval"].AsLong() };

            if (ts.interval == 0) // Disabling timer
                return;

            ts.next = Environment.TickCount + save["Next"].AsLong();

            lock (TimerListLock)
            {
                Timers[MakeTimerKey(objectID, itemID)] = ts;
            }

            //Make sure that the cmd handler thread is running
            m_ScriptEngine.MaintenanceThread.PokeThreads(ts.itemID);
        }
Ejemplo n.º 43
0
        // добавить элемент списка суточных событий
        private void button19_Click(object sender, EventArgs e)
        {
            SaveDataForBack();

            TimerClass newItem = new TimerClass(new DateTime(1996, 1, 1, (int)numericUpDown15.Value, (int)numericUpDown11.Value, (int)numericUpDown10.Value), radioButton25.Checked);
            CtrlProgramsOptions[ProgSelected].ListEventsDay.AddSmart(newItem, 5);

            ReDrawListOfEventsDay();

            //=======================================

            //bool AlreadyExist = false;
            //DateTime dNew, dItem;       // времена для выполнения операции сравнения и присвоения
            //bool newCondition, itemCondition;

            ///*
            //// проверки выхода из допустимого диапазона
            //if (numericUpDown1.Value < 0 && numericUpDown1.Value > 23)
            //    numericUpDown1.Value = 0;
            //if (numericUpDown2.Value < 0 && numericUpDown2.Value > 59)
            //    numericUpDown2.Value = 0;
            //if (numericUpDown3.Value < 0 && numericUpDown3.Value > 59)
            //    numericUpDown3.Value = 0;
            //*/

            //// получение нового добавляемого события
            //dNew = new DateTime(1996, 1, 1, (int)numericUpDown15.Value, (int)numericUpDown11.Value, (int)numericUpDown10.Value);
            //newCondition = radioButton25.Checked;       // описывает состояние контактов

            //int k = 0;
            //foreach (TimerClass Event in CtrlProgramsOptions[ProgSelected].ListEventsDay)
            //{
            //    dItem = new DateTime(1996, 1, 1, Event.DateAndTime.Hour, Event.DateAndTime.Minute, Event.DateAndTime.Second);
            //    itemCondition = Event.Condition;

            //    if (DateTime.Compare(dNew, dItem) == 0)
            //    {
            //        // если время совпало
            //        if (itemCondition == newCondition)
            //        {
            //            // точно такой же таймер уже существует
            //            AlreadyExist = true;
            //            // если такой праздник уже есть в списке
            //            MessageBox.Show("Событие уже уже есть в списке!",
            //                            "Сообщение", MessageBoxButtons.OK,
            //                            MessageBoxIcon.Asterisk);
            //        }
            //        else
            //        {
            //            // если новый таймер отличается только состоянием контактов, то удалить его, а затем создать снова
            //            //CtrlProgramsOptions[ProgSelected].ListEventsException.Remove(EventExept);   // удалить
            //            AlreadyExist = true;
            //            // изменить состояние контактов
            //            CtrlProgramsOptions[ProgSelected].ListEventsDay[k].Condition = !CtrlProgramsOptions[ProgSelected].ListEventsDay[k].Condition;
            //            ReDrawListOfEventsDay();
            //        }
            //    }
            //    k++;
            //}

            //if (AlreadyExist == false)
            //{
            //    // если в коллекции такого таймера нет
            //    // кол-во уже существующих праздников
            //    int imax = CtrlProgramsOptions[ProgSelected].ListEventsDay.Count;
            //    CtrlProgramsOptions[ProgSelected].ListEventsDay.Add(new TimerClass());       // создание пустого элемента коллекции
            //    if (imax != 0)
            //    {
            //        // если в коллекции уже есть элементы
            //        for (int i = imax - 1; i >= 0; i--)
            //        {
            //            // копирование и приведение текущего пункта
            //            dItem = CtrlProgramsOptions[ProgSelected].ListEventsDay[i].DateAndTime;
            //            //dItem = new DateTime(1996, CtrlProgramsOptions[ProgSelected].ListEventsYear[i].DateAndTime.Month, CtrlProgramsOptions[ProgSelected].ListEventsYear[i].DateAndTime.Day, CtrlProgramsOptions[ProgSelected].ListEventsYear[i].DateAndTime.Hour, CtrlProgramsOptions[ProgSelected].ListEventsYear[i].DateAndTime.Minute, CtrlProgramsOptions[ProgSelected].ListEventsYear[i].DateAndTime.Second);
            //            dItem = new DateTime(1996, 1, 1, dItem.Hour, dItem.Minute, dItem.Second);
            //            itemCondition = CtrlProgramsOptions[ProgSelected].ListEventsDay[i].Condition;
            //            if (DateTime.Compare(dNew, dItem) > 0)
            //            {
            //                // если новый праздник больше текущего пункта
            //                CtrlProgramsOptions[ProgSelected].ListEventsDay[i + 1].DateAndTime = dNew;
            //                CtrlProgramsOptions[ProgSelected].ListEventsDay[i + 1].Condition = newCondition;
            //                break;
            //            }
            //            else
            //            {
            //                // если новый праздник меньше текущего
            //                // то скопировать текущий в позицию выше
            //                CtrlProgramsOptions[ProgSelected].ListEventsDay[i + 1].DateAndTime = dItem;
            //                CtrlProgramsOptions[ProgSelected].ListEventsDay[i + 1].Condition = itemCondition;
            //                if (i == 0)
            //                {
            //                    // если это был первый элемент в списке и послдений проверяемый
            //                    // то скопировать на его место новый элемент
            //                    CtrlProgramsOptions[ProgSelected].ListEventsDay[i].DateAndTime = dNew;
            //                    CtrlProgramsOptions[ProgSelected].ListEventsDay[i].Condition = newCondition;
            //                }
            //            }
            //        }
            //    }
            //    else
            //    {
            //        // если в коллекции только один элемент, только что добавленный
            //        CtrlProgramsOptions[ProgSelected].ListEventsDay[0].DateAndTime = dNew;
            //        CtrlProgramsOptions[ProgSelected].ListEventsDay[0].Condition = newCondition;
            //    }
            //    ReDrawListOfEventsDay();
            //}
            //else
            //{

            //}
        }