コード例 #1
0
        public static void Listen <T>(UpdateFunction updateFunction)
        {
            var updateSystems = PlayerLoop.GetCurrentPlayerLoop();

            Listen <T>(ref updateSystems, updateFunction);
            PlayerLoop.SetPlayerLoop(updateSystems);
        }
コード例 #2
0
 public void GoToMatchEnd()
 {
     ResetGame();
     currentUpdate = Update_MatchEnded;
     timer         = 2;
     UpdateScore();
 }
コード例 #3
0
ファイル: Bullet.cs プロジェクト: nsparisi/n3-games
 public Bullet(int direction) : base(ContentLoader.Texure_White)
 {
     SetSize(Constants.BULLET_SIZE, Constants.BULLET_SIZE);
     this.color     = Color.Black;
     this.Direction = direction;
     currentUpdate  = ShootingAway;
 }
 public static IObservableDictionary <TKey, TValue> ToObservableDictionary <TKey, TValue>(
     this IObservable <DictionaryModification <TKey, TValue> > source,
     IObservable <DictionaryModification <TKey, TValue> > changes, UpdateFunction <TKey, TValue> updateFunction,
     IScheduler scheduler)
 {
     return(new ObservableDictionary <TKey, TValue>(source, changes, updateFunction, scheduler));
 }
コード例 #5
0
        public static Boolean SaveReportConfig(UpdateFunction saveFunc, MReportConfig rptConfig)
        {
            rptConfig.PrepareForSaving();
            CTable o = OnixWebServiceAPI.SaveReportConfig(rptConfig.GetDbObject());

            return(true);
        }
コード例 #6
0
 public ObservableDictionary(IObservable <DictionaryModification <TKey, TValue> > initial,
                             IObservable <DictionaryModification <TKey, TValue> > modifications,
                             UpdateFunction <TKey, TValue> updateFunction, IScheduler scheduler) : this(scheduler)
 {
     _initialStream      = initial;
     _modificationStream = modifications;
     _updateFunction     = updateFunction;
 }
コード例 #7
0
 private void setupValues(string title, string content, string bText)
 {
     this.title     = title;
     this.content   = content;
     buttonText     = bText;
     condition      = null;
     updateFunction = null;
 }
コード例 #8
0
        public Task <TransactionReceipt> UpdateRequestAndWaitForReceiptAsync(string newPaciente, string newData, CancellationTokenSource cancellationToken = null)
        {
            var updateFunction = new UpdateFunction();

            updateFunction.NewPaciente = newPaciente;
            updateFunction.NewData     = newData;

            return(ContractHandler.SendRequestAndWaitForReceiptAsync(updateFunction, cancellationToken));
        }
コード例 #9
0
    void Update_DetectModeStart()
    {
        if (Input.GetMouseButtonDown(0))
        {
        }
        else if (Input.GetMouseButtonUp(0) && !DoIClickButton())
        {
            if (!map.AllPlayersCreated() && map.UnitToSpawn != -1)
            {
                Update_CurrentFunction = Update_CreatePlayers;
                Update_CurrentFunction();
            }
            else
            {
                Hex hex = MouseToHex();
                if (hex != null)
                {
                    //Debug.Log("Mouse UP");
                    selectedUnit = hex.getUnit();

                    //flash archerrrrrrrrrrrrrrrrrrrrrrrrrrrr

                    if (selectedUnit != null)
                    {
                        tutorial.OpenPanel("Unit levels are :" + selectedUnit.getLevel(0).ToString() + "--" + selectedUnit.getLevel(1).ToString() + "--" + selectedUnit.getLevel(2).ToString());
                    }

                    if (selectedUnit != null && selectedUnit.getLevel(0) > 0)
                    {
                        StartCoroutine(FlashHexes(map.GetHexesWithinRangeOf(hex, selectedUnit.getLevel(0))));
                    }
                    ////////////////////////////////////////////////////////////////////////////////////////////////
                }
                if (selectedUnit != null && selectedUnit.getPlayer().getId() == map.getCurrentPlayer())
                {
                    Update_CurrentFunction = Update_UnitMovement;
                }
                else
                {
                    tutorial.OpenPanel("Select one of your units to command or a new unit to spawn in one of your free hexes.");
                }
            }
        }
        else if (Input.GetMouseButton(0) && Vector3.Distance(Input.mousePosition, lastPosition) > mouseDragThreshold)
        {
            Update_CurrentFunction  = Update_CameraDrag;
            lastGroundClickPosition = TouchToGroundPlane(Input.mousePosition);
            Update_CurrentFunction();
        }
        if (map.AllPlayersCreated())
        {
            if (map.getCurrentPlayerObject().SkipPlayerTurn())
            {
                map.nextPlayer();
            }
        }
    }
コード例 #10
0
        public Task <string> UpdateRequestAsync(string newPaciente, string newData)
        {
            var updateFunction = new UpdateFunction();

            updateFunction.NewPaciente = newPaciente;
            updateFunction.NewData     = newData;

            return(ContractHandler.SendRequestAsync(updateFunction));
        }
コード例 #11
0
        public Task <string> UpdateRequestAsync(string player, ushort milestone, bool value)
        {
            var updateFunction = new UpdateFunction();

            updateFunction.Player    = player;
            updateFunction.Milestone = milestone;
            updateFunction.Value     = value;

            return(ContractHandler.SendRequestAsync(updateFunction));
        }
コード例 #12
0
 public Animation(InitFunction init, UpdateFunction update, CompletionPredicate pred, Callback callback = null, bool autoUpdate = true)
 {
     initFn              = init;
     updateFn            = update;
     completionPredicate = pred;
     this.callback       = callback;
     initialised         = false;
     completed           = false;
     this.autoUpdate     = autoUpdate;
 }
コード例 #13
0
ファイル: GLWindow.cs プロジェクト: sudocoders/renderer
 /// <summary>
 /// 
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="name"></param>
 /// <param name="fullscreen"></param>
 public GLWindow(int width, int height, string name, GameWindowFlags fullscreen)
     : base(width, height, GraphicsMode.Default, name, fullscreen, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible)
 {
     Renderables = new List<IRenderable>();
     ClearColor = new Color4();
     OnLoadFunction = null;
     OnUpdateFunction = null;
     KeyEvents = new Dictionary<Key, Action>();
     MouseEvents = new Dictionary<MouseInformation, Action>();
 }
コード例 #14
0
 void InfoScreen()
 {
     if (Input.GetButtonUp("ButtonD0") || Input.GetButtonUp("ButtonC0") || Input.GetButtonUp("ButtonB0"))
     {
         infoScreen.enabled    = false;
         titleLogo.enabled     = true;
         pressStart.enabled    = true;
         currentUpdateFunction = TitleScreen;
     }
 }
コード例 #15
0
        public Task <TransactionReceipt> UpdateRequestAndWaitForReceiptAsync(string player, ushort milestone, bool value, CancellationTokenSource cancellationToken = null)
        {
            var updateFunction = new UpdateFunction();

            updateFunction.Player    = player;
            updateFunction.Milestone = milestone;
            updateFunction.Value     = value;

            return(ContractHandler.SendRequestAndWaitForReceiptAsync(updateFunction, cancellationToken));
        }
コード例 #16
0
 void MoveToCharacterSelect()
 {
     ChangeBackgroundMusic("audio/music/characterSelect/StrengthOfWillcut");
     titleLogo.enabled = false;
     titleLogo.transform.GetChild(0).gameObject.SetActive(false);
     pressStart.enabled = false;
     background.enabled = true;
     characterSelectManager.Reset();
     characterSelectManager.SetControllers(player1Controller, player2Controller);
     currentUpdateFunction = CharacterSelect;
 }
コード例 #17
0
 // 新增UpdateFunc
 private void AddUpdateFunc(string name, UpdateFunction func)
 {
     if (!funcList.ContainsKey(name))
     {
         funcList.Add(name, func);
     }
     else
     {
         SaveLog($"[Warning] {name} Function Repeat");
     }
 }
コード例 #18
0
 void ResetGame()
 {
     ClearObjects();
     titleLogo.enabled = true;
     titleLogo.transform.GetChild(0).gameObject.SetActive(true);
     pressStart.enabled = true;
     background.enabled = true;
     roundTimer.enabled = false;
     ChangeBackgroundMusic("audio/music/menu/LandOfTwoFields");
     currentUpdateFunction = TitleScreen;
     ToggleUI(false);
 }
コード例 #19
0
        /// <summary>
        /// Creates a render loop instance from the given context and method reference.
        /// </summary>
        /// <param name="gfx">The relevant graphics context.</param>
        /// <param name="update">The relevant update function.</param>
        /// <param name="frameRate">The desired fixed frame rate or -1 for unlimited.</param>
        public static GameLoop Create(GraphicsContext gfx, UpdateFunction update, int frameRate = -1)
        {
            if (gfx is null)
            {
                throw new ArgumentNullException(nameof(gfx));
            }
            if (update is null)
            {
                throw new ArgumentNullException(nameof(update));
            }

            return(new DefaultRenderLoop(gfx, update, frameRate));
        }
コード例 #20
0
 // Use this for initialization
 void Start()
 {
     Update_CurrentFunction = Update_ModeDetect;
     hexGrid      = GameObject.FindObjectOfType <HexGrid>();
     linerenderer = transform.GetComponentInChildren <LineRenderer>();
     UnitPanel.SetActive(false);
     GameOverScreen.SetActive(false);
     DamageLog.SetActive(false);
     selections = new List <GameObject>();
     RangeBoxes = new List <GameObject>();
     dmgLog     = new List <DamageLogEntry>();
     PopUpController.Initialize();
 }
コード例 #21
0
ファイル: DocumentSchema.cs プロジェクト: srasch/marten
        public DocumentSchema(DocumentMapping mapping)
        {
            _mapping = mapping;

            Table  = new DocumentTable(_mapping);
            Upsert = new UpsertFunction(_mapping);
            Insert = new InsertFunction(_mapping);
            Update = new UpdateFunction(_mapping);

            if (_mapping.UseOptimisticConcurrency)
            {
                Overwrite = new OverwriteFunction(_mapping);
            }
        }
コード例 #22
0
 private void Reset_Mode()
 {
     if (!(Update_CurrentFunction == Update_CameraMovement))
     {
         Selectedunit  = null;
         Path          = null;
         TargetUnit    = null;
         selectedSquad = null;
         targetSquad   = null;
         ChargedSquads = new List <List <Unit> >();
     }
     Update_CurrentFunction = Update_ModeDetect;
     checkWounds();
 }
コード例 #23
0
        /*
         * PUBLIC METHODS
         * */
        public bool configure(Mode m, UpdateFunction c, string p)
        {
            UpdateCycle = c;
            FilePath    = p;
            mode        = m;

            switch (mode)
            {
            case Mode.Record:
                oldSequence.init();
                currentSequence.init();

                inputRecordStream = new StreamWriter(FilePath, false);      // will overwrite new file Stream
                if (inputRecordStream.ToString() == "")
                {
                    Stop();
                    Debug.Log("InputReplay: StreamWriter(" + FilePath + "), file not found ?");
                    return(false);
                }
                else
                {
                    inputRecordStream.AutoFlush = true;
                    SetInputStd();
                }
                break;

            case Mode.PlayBack:
                oldSequence.init();
                currentSequence.init();
                nextSequence.init();

                inputPlaybackStream = new StreamReader(FilePath, false);
                if (inputPlaybackStream.ToString() == "")
                {
                    Stop();
                    Debug.Log("InputReplay: StreamReader(" + FilePath + "), file not found ?");
                    return(false);
                }
                else if (!ReadLine())     // read the first line to check
                {
                    Stop();
                    Debug.Log("InputReplay: empty file");
                    return(false);
                }
                break;
            }

            return(true);
        }
コード例 #24
0
        static void Main(string[] args)
        {
            try
            {
                if (args.Count() > 0)
                {
                    if (args[0] == Link)
                    {
                        LinkFunction.SendLink(args[1]);
                    }
                    else
                    {
                        bool hasSecondArgument = args.Count() > 1 ? true : false;
                        switch (args[0])
                        {
                        case Update:
                            if (hasSecondArgument && args[1] == UpdateArgument.Restart)
                            {
                                UpdateFunction.Update(true);
                            }
                            else
                            {
                                UpdateFunction.Update(false);
                            }
                            break;

                        case Ngen:
                            break;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Puuuuuuuu 我才不要理你。"
                                    + Environment.NewLine + Environment.NewLine +
                                    "Ps:如果你想启动 osi 的话 你应该双击 osi.exe");
                }
            }
            catch (Exception e)
            {
#if DEBUG
                MessageBox.Show(e.Message + "   " + e.Source
                                + Environment.NewLine +
                                e.StackTrace);
#endif
                exitCode = ExitCode.Error;
            }
            Environment.Exit(exitCode);
        }
コード例 #25
0
    public void DelayedStart()
    {
        mainCam   = Camera.main;
        offsetMag = offset.magnitude;
        switch (carViewMode)
        {
        case CarViewMode.Classic3D:
            updateFunction += PerspectiveUpdate;
            break;

        case CarViewMode.Orthographic:
            updateFunction += OrthographicUpdate;
            break;
        }
    }
コード例 #26
0
        //--------------------Constructors--------------------//
        internal ParticleSystem(ParticleType type, Vector3 position, ParticleSpawner spawner, ContentManager content, int particleMax, int particleMaxTime, float particleSpawnRate, bool shouldStartSpawing = true)
        {
            particleType           = type;
            currentParticles       = new List <Particle>();
            particleCount          = 0;
            this.particleMax       = particleMax;
            this.particleMaxTime   = particleMaxTime;
            this.particleSpawnRate = particleSpawnRate;
            lastParticleSpawn      = new GameTime();

            effect = new BasicEffect(Game1.graphics.GraphicsDevice);
            effect.TextureEnabled = true;
            systemPosition        = position;
            this.spawner          = spawner;
            random      = new Random();
            shouldSpawn = shouldStartSpawing;

            switch (type)
            {
            case ParticleType.Rain:
                particleTexture = content.Load <Texture2D>("waterTest");
                typeUpdate      = new UpdateFunction(RainUpdate);
                accelaration    = new Vector3(0.0f, -0.98f, 0.0f);
                break;

            case ParticleType.Explosion:
                particleTexture = content.Load <Texture2D>("Smoke");
                typeUpdate      = new UpdateFunction(ExplosionUpdate);
                accelaration    = new Vector3(0.0f, -0.05f, 0.0f);
                #region Add Particles
                for (int i = 0; i < particleMax; i++)
                {
                    Vector3 auxPosition = spawner.GetPositions(1, systemPosition)[0];
                    Vector3 direction   = Vector3.Normalize(auxPosition - systemPosition) * EXPLOSION_FORCE;
                    currentParticles.Add(new Particle(auxPosition, direction, 0.1f));
                    particleCount++;
                }
                #endregion
                break;

            case ParticleType.Smoke:
                particleTexture = content.Load <Texture2D>("Smoke");
                typeUpdate      = new UpdateFunction(SmokeUpdate);
                accelaration    = new Vector3(0.0f, 0.01f, 0.0f);
                break;
            }
        }
コード例 #27
0
    void Update()
    {
        //      hexUnderMouse = MouseToHex();
        //       if(Input.touchCount == 0)
        //       {
        //          CancelUpdateFuntion();
        //      }
        if (Update_CurrentFunction == null)
        {
            Update_CurrentFunction = Update_DetectModeStart;
        }
        Update_CurrentFunction();

        lastPosition = Input.mousePosition;

        //       lastHexUnderMouse = hexUnderMouse;
    }
コード例 #28
0
    void StartRound()
    {
        if (Application.isEditor)
        {
            player1 = playerFactory.CreatePlayerInEditor(CreateControlScheme(0), characterSelectManager.p1Character, player1Pos, 0);
            player2 = playerFactory.CreatePlayerInEditor(CreateControlScheme(1), characterSelectManager.p2Character, player2Pos, 1);
        }
        else
        {
            player1 = playerFactory.CreatePlayerWithController(player1Controller, characterSelectManager.p1Character, player1Pos, 0);
            player2 = playerFactory.CreatePlayerWithController(player2Controller, characterSelectManager.p2Character, player2Pos, 1);
        }
        CreateBars();
        CreateObstacles();
        currentUpdateFunction = InGameUpdate;

        FightIntro();
    }
コード例 #29
0
    void InGameUpdate()
    {
        if (timerStarted)
        {
            currentRoundTime -= Time.deltaTime;
            roundTimer.text   = Mathf.RoundToInt(currentRoundTime).ToString();
        }

        if (player1Stats.health <= 0 || player2Stats.health <= 0 || currentRoundTime <= 0)
        {
            LockPlayers();
            if (player1Stats.health <= 0 && player2Stats.health <= 0 ||
                player1Stats.health == player2Stats.health)
            {
                StartCoroutine(DisplayVictoryText(5, 0));
            }
            else if (player1Stats.health <= 0 || player1Stats.health < player2Stats.health)
            {
                player2RoundWins++;
                Destroy(player1);
                StartCoroutine(DisplayVictoryText(2, player2RoundWins));
                SetWinsIconsSR[player2RoundWins - 1].enabled = true;
            }
            else if (player2Stats.health <= 0 || player2Stats.health < player1Stats.health)
            {
                player1RoundWins++;
                Destroy(player2);
                StartCoroutine(DisplayVictoryText(1, player1RoundWins));
                HorusWinsIconsSR[player1RoundWins - 1].enabled = true;
            }
            currentUpdateFunction = RoundEndUpdate;
            ClearBullets();
            foreach (Transform bar in player1Stats.bufferBar)
            {
                bar.gameObject.SetActive(true);
            }
            foreach (Transform bar in player2Stats.bufferBar)
            {
                bar.gameObject.SetActive(true);
            }
            AnalyticsEngine.PrintRow();
        }
    }
コード例 #30
0
ファイル: DocumentSchema.cs プロジェクト: tonykaralis/marten
        public DocumentSchema(DocumentMapping mapping)
        {
            _mapping = mapping;

            Table = new DocumentTable(_mapping);

            foreach (var metadataColumn in Table.Columns.OfType <MetadataColumn>())
            {
                metadataColumn.RegisterForLinqSearching(mapping);
            }

            Upsert = new UpsertFunction(_mapping);
            Insert = new InsertFunction(_mapping);
            Update = new UpdateFunction(_mapping);

            if (_mapping.UseOptimisticConcurrency)
            {
                Overwrite = new OverwriteFunction(_mapping);
            }
        }
コード例 #31
0
    // Use this for initialization
    void Start()
    {
        p1LifeBar   = GameObject.Find("P1LifeBar");
        p1BufferBar = GameObject.Find("P1BufferBarSegments");
        p2LifeBar   = GameObject.Find("P2LifeBar");
        p2BufferBar = GameObject.Find("P2BufferBarSegments");
        UIElements  = GameObject.Find("InGameUIElements");
        ToggleUI(false);

        victoryText = GameObject.FindGameObjectWithTag("VictoryText").GetComponent <Text>();

        //bullets = new BulletDepot(); // clearing a warning w/next line - ski
        bullets = ScriptableObject.CreateInstance <BulletDepot>();
        bullets.Load();

        playerFactory         = GetComponent <PlayerInitializer>();
        playerFactory.bullets = bullets;
        player1Controls       = CreateControlScheme(0);
        player2Controls       = CreateControlScheme(1);
        background            = GameObject.FindGameObjectWithTag("Background").GetComponent <SpriteRenderer>();

        characterSelectManager = GetComponent <CharacterSelectManager>();
        int numCharacters = System.Enum.GetNames(typeof(Character)).Length;

        AnalyticsEngine.Initialize(new string[] { "LoholtBulletsFired", "OrpheusBulletsFired", "HirukoBulletsFired" });
        characterSelectManager.Reset();
        currentUpdateFunction = CharacterSelect;
        menuController        = GameObject.Find("Canvas").GetComponent <MenuController>();
        player1Controller     = InputManager.ActiveDevice;
        foreach (InputDevice controller in InputManager.Devices)
        {
            if (controller != InputManager.ActiveDevice)
            {
                player2Controller = controller;
            }
        }
        characterSelectManager.SetControllers(player1Controller, player2Controller);
        //menuController.Toggle();
    }
コード例 #32
0
        /// <summary>
        /// Register an event to function for the slider.
        /// </summary>
        public bool Register(UIEvent uiEvent, UpdateFunction function)
        {
            if(uiEvent == UIEvent.Update)
            {
                Log.Debug("Register event:"+uiEvent+" to button:"+gameObject.name);
                onUpdate = function;
                return true;
            }

            return false;
        }