Inheritance: MonoBehaviour
        public void Run(StopWatch stopWatch)
        {
            //		_bus.Subscribe<RequestConsumer>();
            //	_bus.Subscribe<ResponseConsumer>();

            stopWatch.Start();

            CheckPoint publishCheckpoint = stopWatch.Mark("Publishing " + _repeatCount + " messages");
            CheckPoint receiveCheckpoint = stopWatch.Mark("Receiving " + _repeatCount + " messages");

            for (int index = 0; index < _repeatCount; index++)
            {
                _bus.Publish(new GeneralMessage());
            }

            publishCheckpoint.Complete(_repeatCount);

            bool completed = _completeEvent.WaitOne(TimeSpan.FromSeconds(60), true);

            bool responseCompleted = _responseEvent.WaitOne(TimeSpan.FromSeconds(60), true);

            receiveCheckpoint.Complete(_counter + _responseCounter);

            stopWatch.Stop();
        }
 //debug code
 private void DebugReset()
 {
     transform.SetPositionAndRotation(def_p, def_q);
     from    = def_f_CP;
     to      = def_t_CP;
     looking = def_l;
 }
Exemple #3
0
    public static void loot(GameObject go)
    {
        ItemOnField itm = go.GetComponent <ItemOnField> ();

        if (itm)
        {
            PlayerItems.AddItem(itm.itemName, itm.count);
            MusicProc.doEvent(ActionEvent.Loot, itm.itemName);
            Destroy(go);
            return;
        }
        CheckPoint cp = go.GetComponent <CheckPoint> ();

        if (cp)
        {
            if (cp.finalDoor)
            {
                instance.LevelDone();
            }
            else
            {
                cp.check();
            }
        }
    }
 public CheckPointDetailDialog ShowDetailDialog(CheckPointDetailDialog dialog,CheckPoint Data=null)
 {
     if (Data == null)
         Data = LastCheckpointDetailed;
     this.Controller.NavigateToDialog (dialog);
     return dialog;
 }
Exemple #5
0
        public IEnumerator JumpTo(CheckPoint checkPoint)
        {
            animator.SetTrigger("Jump");
            yield return(StartCoroutine(checkPointMoveBehaviour.MoveTo(checkPoint, jumpTime, jumpDelay)));

            animator.SetTrigger("Stop");
        }
 //Moves players to the positions at the checkpoint
 public void setPlayers(CheckPoint checkpoint)
 {
     playerList[0].gameObject.GetComponent <NavMeshAgent>().Warp(checkpoint.player1.transform.position);
     playerList[1].gameObject.GetComponent <NavMeshAgent>().Warp(checkpoint.player2.transform.position);
     playerList[2].gameObject.GetComponent <NavMeshAgent>().Warp(checkpoint.player3.transform.position);
     playerList[3].gameObject.GetComponent <NavMeshAgent>().Warp(checkpoint.player4.transform.position);
 }
Exemple #7
0
        public IEnumerator WalkTo(CheckPoint checkPoint)
        {
            animator.SetTrigger("Walk");
            yield return(StartCoroutine(checkPointMoveBehaviour.MoveTo(checkPoint, walkTime, 0)));

            animator.SetTrigger("Stop");
        }
Exemple #8
0
        public IHttpActionResult DeleteCheckPoint(int id)
        {
            CheckPoint checkpoint = db.Beacons.Find(id);

            checkpoint.Active = false;
            if (checkpoint == null)
            {
                return(NotFound());
            }
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CheckPointExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(Ok(checkpoint));
        }
Exemple #9
0
        public IHttpActionResult PutCheckPoint(int id, CheckPoint checkpoint)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != checkpoint.ID)
            {
                return(BadRequest());
            }

            db.Entry(checkpoint).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CheckPointExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok());
        }
Exemple #10
0
 public void AcceptCheckPoint(CheckPoint checkPoint)
 {
     if (!checkPoints.Contains(checkPoint))
     {
         checkPoints.Add(checkPoint);
     }
 }
Exemple #11
0
 public void checkpoint(CheckPoint checkpoint, LogPosition checkpointEntryPosition)
 {
     if (_filter == null || _filter(new LogEntry[] { checkpoint }))
     {
         @out.println(_serializer(checkpoint));
     }
 }
Exemple #12
0
 /// <summary>
 /// Возвращает набор состояний,
 /// для которых значение проверки равно параметру value
 /// </summary>
 private List <State> GetListStateByCheckPointValue(List <State> listState, CheckPoint checkPoint, bool value)
 {
     return(listState.Where(state =>
                            GetDIByCheckState(checkPoint.Check, state)
                            .ValueCheck
                            .GetValue(checkPoint.Bit) == value).ToList());
 }
Exemple #13
0
	void updateCheckPoint(){
		foreach(CheckPoint point in points){
			if(point.activated && point.value > currentCheckPoint.value){
				currentCheckPoint = point;
			}
		}
	}
Exemple #14
0
        private void OnTriggerEnter(Collider other)
        {
            if (!other.CompareTag("Player"))
            {
                return;
            }

            StartCoroutine(BlockPreviousArea());
            var o          = other.gameObject;
            var position   = o.transform.position;
            var rotation   = o.transform.rotation;
            var checkPoint = new CheckPoint
            {
                XPos = position.x,
                YPos = position.y,
                ZPos = position.z,
                //StarCount =
                XRot = rotation.x,
                YRot = rotation.y,
                ZRot = rotation.z,
            };

            EventService.WriteCheckPoint(checkPoint);
            Debug.Log(EventService.LoadCheckPoint().XPos);
            Destroy(this);
        }
Exemple #15
0
    /*
     * Allows the player to restart the level they are currently on.
     */
    public void RestartLevel(bool dead = false)
    {
        if (dead)
        {
            CheckPoint lastCheckPoint = checkPointManager.GetClosestCheckPoint(playerControl.transform.position);

            playerControl.ResetPositions();

            playerRigidbody.MovePosition(lastCheckPoint.GetCheckPointPosition());

            // Reset the player's velocity and looking angle.
            playerRigidbody.velocity = Vector3.zero;
            playerControl.SetCameraRotation(new Vector2(lastCheckPoint.GetRespawnRotation(), 0f));

            // If rewind is enabled, these methods are called before the rewind begins.
            if (!RewindEnabled)
            {
                ResetPlayer();
                ResetLevelObjects();
            }
        }
        else
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }
    }
        public AddHistoricInstanceDialog(iCheckpointCommandController checkPoints, RootElement root, CheckPoint checkpoint, bool pushing)
            : base()
        {
            this.Root = root;
            this.CheckPoints = checkPoints;
            this.checkPoint = checkpoint;

            this.picker = new UIDatePicker (){ Mode = UIDatePickerMode.DateAndTime };
            this.picker.MaximumDate = DateTime.UtcNow.ToNSDate();

            var pickerElement = new UIViewElement (string.Empty, this.picker, false);

            this.picker.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;

            this.nowSwitch = new BooleanElement ("Reset to now:", true);

            picker.ValueChanged += (s, e) => nowSwitch.Value=false;

            nowSwitch.ValueChanged += (s, e) => {
                if (nowSwitch.Value)
                    this.picker.Date = DateTime.UtcNow.ToNSDate ();
            };

            this.Root.Add(new CheckPointCellSection(this.checkPoint));

            this.Root.Add (new Section ("Completed on:")
                {
                    new MultilineElement("Specify the time of completion:"),
                    pickerElement,
                    nowSwitch});

            this.NavigationItem.SetRightBarButtonItem (new UIBarButtonItem (UIBarButtonSystemItem.Save,(s,e)=>this.Save()),true);
        }
    public IEnumerator ToListCheckpoint(JArray checkpointsArray, System.Action <List <CheckPoint> > b)
    {
        List <CheckPoint> checkpoints = new List <CheckPoint>();

        foreach (var item in checkpointsArray)
        {
            JObject parse    = JObject.Parse(item.ToString());
            string  text     = (string)parse["text"];
            string  question = (string)parse["question"];
            //TODO: est-ce que ça plante ici quand on ajoute les images (qui ne sont pas envoyées dans le cas de getAllQuests !)
            string        picture      = (string)parse["picture"];
            string        pictureName  = (string)parse["pictureName"];
            JArray        choicesArray = (JArray)parse["choices"];
            List <string> choices      = new List <string>();
            foreach (var choice in choicesArray)
            {
                choices.Add(choice.ToString());
            }

            string answer     = (string)parse["enigmAnswer"];
            int    difficulty = (int)parse["difficulty"];
            Badge  badge      = null;
            if ((string)parse["_idBadge"] != "" && (string)parse["_idBadge"] != null)
            {
                yield return(HTTPHelper.Instance.GetBadge((string)parse["_idBadge"], value => badge = value));
            }
            CheckPoint checkPoint = new CheckPoint(picture, pictureName, text, question, choices, answer, difficulty, badge);
            checkpoints.Add(checkPoint);
        }

        b(checkpoints);
    }
Exemple #18
0
 void Awake()
 {
     playerStats      = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStats>();    // getting the PlayerStats script from the Player
     audio            = GetComponent <AudioSource>();
     checkPointScript = GameObject.FindGameObjectWithTag("Checkpoint").GetComponent <CheckPoint>(); // getting the CheckPoint script from the CheckPoint
     life             = playerStats.health;
 }
Exemple #19
0
        private async void OnFinish1Game()
        {
            var pos = Camera.GlobalPosition;

            Camera.GetParent()?.RemoveChild(Camera);
            Camera.GlobalPosition = pos;
            AddChild(Camera);

            RotationAnimationPlayer.Start(Player);
            Player.ActionLock.Lock();
            Player.Velocity = Vector2.Zero;
            await ToSignal(RotationAnimationPlayer, "animation_finished");

            AssignCamera(Player);
            Player.GlobalPosition += Vector2.Up * 10;
            CheckPoint             = null;

            EnabledSuicide = true;
            UpsideDown     = true;
            UI.EnableSuicide();

            Player.Rotation        = Mathf.Pi; // TODO: Add to animation
            Player.Suicide.Enabled = true;

            Player.ActionLock.Unlock();
        }
        public virtual IEnumerable<CheckPoint> ReadCheckPoints()
        {
            if (Paths.Exists(this.CheckpointPath))
            {
                var read = Paths.ReadAllLines (this.CheckpointPath);
                if(read.Count()>10)
                    yield break;
                if (read.Any ())
                {
                    CheckPoint created = new CheckPoint();
                    foreach (var line in read) {

                        var parts = line.Split ('|');
                        var name = parts [0];
                        var targetTime = TimeSpan.Parse (parts [1]);
                        var enabled = bool.Parse (parts [2]);
                        var emoji = parts [3];
                            created = new CheckPoint (){ Name = name, TargetTime = targetTime, IsEnabled = enabled,Emoji=emoji };

                        yield return created;
                    }
                }
            }
            yield break;
        }
Exemple #21
0
 public void OnPlayerRespawnInThisCheckPoint(CheckPoint checkpoint, Player player)
 {
     if (isRespawnCheckPoint)
     {
         gameObject.SetActive(true);
     }
 }
    public List <CheckPoint> GetCheckPoins()
    {
        List <CheckPoint> checkpoints      = new List <CheckPoint>();
        string            connectionString = ConfigurationManager.ConnectionStrings["lusdMembership"].ConnectionString;

        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            SqlCommand cmd = new SqlCommand("SELECT chk1, chk2, chk3, chk4, chk5 FROM checkpoints", connection);
            connection.Open();
            using (SqlDataReader reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    CheckPoint c = new CheckPoint
                    {
                        CheckPoint1 = reader["chk1"].ToString(),
                        CheckPoint2 = reader["chk2"].ToString(),
                        CheckPoint3 = reader["chk3"].ToString(),
                        CheckPoint4 = reader["chk4"].ToString(),
                        CheckPoint5 = reader["chk5"].ToString(),
                    };
                    checkpoints.Add(c);
                }
                connection.Close();
            }
        }
        return(checkpoints);
    }
Exemple #23
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit _hit;

            Ray _ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(_ray, out _hit, 100.0f))
            {
                if (_hit.collider.name == "MENU")
                {
                    ADSController.instance.StartCoroutine(ADSController.hideBanner());

                    CheckPoint.reset();

                    Director.sharedDirector().LoadLevelWithFade(LevelManager.getLevelID(Level.menu));
                }
                else if (_hit.collider.name == "CONTINUE")
                {
                    ADSController.instance.StartCoroutine(ADSController.hideBanner());

                    Director.sharedDirector().restartScene();
                }
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        if (GameInstance.CurrentLevel != null && GameInstance.CurrentLevel.isCustom)
        {
            LoadCustomLevel();
        }

        Instance       = this;
        Time.timeScale = 1;
        winMenu.gameObject.SetActive(false);



        Spawnpoint = initialSpawnPoint;
        if (Spawnpoint == null)
        {
            Spawnpoint = GameObject.Find("InitSpawnPoint").GetComponent <CheckPoint>();
        }

        Spawnpoint.TurnOn();
        SpawnNewPlayer();
        centerText.text = "";
        paused          = false;
        PauseUI.SetActive(false);
        StartTime = Time.time;
    }
 public IEnumerable<UIPreviewAction> GetPreviewActionsForCheckpoint(CheckPoint toView,Action<Command> handler)
 {
     return this.Commands.Values
         .Where (u => u.ShouldDecorate (toView))
         .Where(u=> (u as IDialogBoundCommand)==null)
                .Select (u => u.AsPreviewAction (InstrumentationDecorator("peek",u,toView,c=>handler(c))));
 }
        public override bool ShouldDecorate(CheckPoint toDecorate)
        {
            if (toDecorate.RelativeTarget != null)
                return false;

            return base.ShouldDecorate (toDecorate);
        }
Exemple #27
0
        /// <summary>
        /// Возвращает J для текущего шага (Гибридный муравьиный алгоритм)
        /// </summary>
        private double FindHybridJ(List <List <State> > S, CheckPoint numberMinI)
        {
            // Множество минимумов для unusedI
            List <double> minForUnused = new List <double>();

            //идем по всем подмножествам State
            for (int subS = 0; subS < S.Count; subS++)
            {
                // Счетчики нулей и единиц
                int count0 = 0;
                int count1 = 0;
                // Идем по всем State
                for (int k = 0; k < States.Count; k++)
                {
                    // Если в подмножестве технических состояний содержится нужное
                    if (S[subS].Contains(States[k]))
                    {
                        if (GetDIByCheckState(numberMinI.Check, States[k])
                            .ValueCheck
                            .GetValue(numberMinI.Bit))
                        {
                            count1++;
                        }
                        else
                        {
                            count0++;
                        }
                    }
                }
                // Вычисляем для текущего подмножества State минимум
                // Проверка на 0, иначе логарифмы не существуют
                if (count0 == 0 || count1 == 0)
                {
                    if (count0 == 0)
                    {
                        minForUnused.Add(((double)count1 / S[subS].Count * Math.Log(count1, 2))
                                         * (double)S[subS].Count / (States.Count));
                    }
                    if (count1 == 0)
                    {
                        minForUnused.Add(((double)count0 / S[subS].Count * Math.Log(count0, 2))
                                         * (double)S[subS].Count / (States.Count));
                    }
                }
                else
                {
                    minForUnused.Add(((double)count0 / S[subS].Count * Math.Log(count0, 2)
                                      + (double)count1 / S[subS].Count * Math.Log(count1, 2))
                                     * (double)S[subS].Count / (States.Count));
                }
            }
            double result = 0;

            for (int t = 0; t < minForUnused.Count; t++)
            {
                result += minForUnused[t];
            }
            return(result);
        }
Exemple #28
0
 public static CheckPoint getInstance(float _x, float _y)
 {
     if (instance == null)
     {
         instance = new CheckPoint(_x, _y);
     }
     return(instance);
 }
Exemple #29
0
 /// <summary>
 /// Get required references
 /// </summary>
 protected override void GetReferences()
 {
     base.GetReferences();
     Matinee = GetComponent<Matinee>();
     _CheckPoint = GetComponent<CheckPoint>();
     if (Matinee == null) throw new MissingComponentException("MatineeBreak needs a Matinee component");
     if (_CheckPoint == null) throw new MissingComponentException("MatineeBreak needs a CheckPoint component");
 }
Exemple #30
0
 public void Awake()
 {
     Object checkPointObject = FindObjectOfType (typeof(CheckPoint));
     if(checkPointObject != null)
     {
         checkPoint = checkPointObject as CheckPoint;
     }
 }
Exemple #31
0
    void move()
    {
        CheckPoint point = checkpoint.GetComponent <CheckPoint>();

        checkpoint        = point.getRandom();
        agent.destination = checkpoint.position;
        Invoke("move", 5f);
    }
    void Start()
    {
        Back.onClick.AddListener(() => BackToFront());
        Skin.onClick.AddListener(() => ToSkinMenu());
        currentWorld.onClick.AddListener(() => GotoActionPhase(GameData.I.GetWorld()));

        lv = Utility.ReadCheckPoint();
    }
 public void OnPlayerRespawnInThisCheckpoint(CheckPoint checkpoint, Player player)
 {
     _direction = new Vector2(-1, 0);
     transform.localScale = new Vector3(1, 1, 1);
     transform.position = _startPosition;
     _currentHealth = MaxHealth;
     gameObject.SetActive(true);
 }
Exemple #34
0
 public void ConnectToGate(Gate gate, CheckPoint checkpoint)
 {
     myGate           = gate;
     myGateID         = myGate.gateId;
     transform.parent = myGate.transform;
     myCheckPoint     = checkpoint;
     SetStartPositionAndRotation();
 }
Exemple #35
0
    public void addCheckPoint(string taskDescription = "")
    {
        last       = new CheckPoint(last, taskDescription);
        totalTime += last.getTimeDiff();
        string message = last.getInfo();

        addAndPrint(message);
    }
        public void CheckPoint7a()
        {
            var cp = new CheckPoint(new DateTime(2015, 6, 4, 2, 0, 0, DateTimeKind.Utc));//10PM

            Assert.AreEqual(7, cp.CP);
            Assert.AreEqual(0, cp.Cycle.Id);
            Console.WriteLine(cp.DateTime);
        }
Exemple #37
0
    public void LoadCheckPoint(CheckPoint checkpoint)
    {
        Player player = Player.Instance;

        player.transform.position = checkpoint.transform.position;
        player.velocity           = Vector3.zero;
        player.LookTowards(checkpoint.transform.forward);
    }
Exemple #38
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         CheckPoint.SetCheckPointTransfrom(transform.parent.transform.localPosition);
         transform.parent.gameObject.SetActive(false);
     }
 }
        public CheckPointStatsSection(CheckPoint checkpoint,Action reloader)
        {
            this.Caption="Stats:";
            var eval = new CheckPointEvaluator (checkpoint);

            this.Add(new MultilineElement(eval.Evaluation));

            this.Add (new StringElement ("Enabled?", checkpoint.IsEnabled?"Yes":"No"));

            var createdElement = new ToggledStringElement ("Created");
            createdElement.PrimaryValueGenerator = () => checkpoint.CreatedOn.Humanize (false);
            createdElement.SecondaryValueGenerator = () => checkpoint.CreatedOn.ToString ("G");
            createdElement.PrimaryCaptionGenerator = () => "Created";
            createdElement.SecondaryCaptionGenerator = () => "Created on:";
            createdElement.Tapped += reloader;
            createdElement.Toggle ();
            this.Add (createdElement);

            var nextElement = new ToggledStringElement ("Next");
            nextElement.PrimaryValueGenerator = () => checkpoint.UntilNextTargetTime.Humanize (2);

            var nextCompletionDay = DateTime.Today.AddDays(checkpoint.CompletedToday ? 0 : 1);

            nextElement.SecondaryValueGenerator = () =>
                (nextCompletionDay + checkpoint.TargetTimeForDay(nextCompletionDay.DayOfWeek)).ToString("G");
            nextElement.PrimaryCaptionGenerator = () => "Next in";
            nextElement.SecondaryCaptionGenerator = () => "Next at";
            nextElement.Tapped += reloader;
            nextElement.Toggle ();
            this.Add (nextElement);

            if (checkpoint.Occurrences.Any ())
            {

                var earliest = new ToggledStringElement ("Earliest");
                earliest.PrimaryValueGenerator = () => checkpoint.Earliest.Time.ToAMPMString ();
                earliest.SecondaryValueGenerator = () => checkpoint.Earliest.TimeStamp.ToString ("G");

                var latest = new ToggledStringElement ("Latest");
                latest.PrimaryValueGenerator = () => checkpoint.Latest.Time.ToAMPMString ();
                latest.SecondaryValueGenerator = () => checkpoint.Latest.TimeStamp.ToString ("G");

                var mostRecent = new ToggledStringElement ("Since Most Recent");
                mostRecent.PrimaryValueGenerator = () => checkpoint.SinceLastOccurrence.Humanize (1)+" ago";
                mostRecent.SecondaryValueGenerator = () => checkpoint.MostRecentOccurrenceTimeStamp().ToString("G");

                foreach (var el in new[]{earliest,latest,mostRecent})
                {
                    el.Tapped += reloader;
                    el.Toggle ();
                    this.Add (el);
                }
            }
            if(checkpoint.ScheduledTargets.Any())
            {
                this.Add (new StringElement ("Target", (DateTime.Today + checkpoint.TargetTime).ToString ("t")));
            }
        }
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            GameStateMachine.Instance.DrawBackground = false;
            HUD.Instance.FreezeHUD = true;
            string worldDisplayText = "WORLD " + HUD.Instance.CurrentWorld.ToString() + "-" + HUD.Instance.CurrentStage.ToString() + "\n";
            string livesRemaining = " x " + Mario.Instance.Lives;
            Vector2 livesOrigin = GameStateMachine.Instance.GameFont.MeasureString(livesRemaining) / 2;
            Vector2 worldDisplayOrigin = GameStateMachine.Instance.GameFont.MeasureString(worldDisplayText) / 2;
            spriteBatch.End();

            GameStateMachine.Instance.Graphics.GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin();
            spriteBatch.DrawString(GameStateMachine.Instance.GameFont, worldDisplayText, new Vector2((GameStateMachine.Instance.Graphics.GraphicsDevice.Viewport.Width / 2) - worldDisplayOrigin.X, (GameStateMachine.Instance.Graphics.GraphicsDevice.Viewport.Height / 2) - livesOrigin.Y * 2), Color.White);
            spriteBatch.DrawString(GameStateMachine.Instance.GameFont, livesRemaining, new Vector2((GameStateMachine.Instance.Graphics.GraphicsDevice.Viewport.Width / 2) - livesOrigin.X, GameStateMachine.Instance.Graphics.GraphicsDevice.Viewport.Height / 2), Color.White);
            AnimatedSprite marioLife = AnimatedSpriteFactory.Instance.BuildMarioLifeSprite(new Vector2((GameStateMachine.Instance.Graphics.GraphicsDevice.Viewport.Width / 2) - livesOrigin.X * 2, GameStateMachine.Instance.Graphics.GraphicsDevice.Viewport.Height / 2 + worldDisplayOrigin.Y / 3));
            marioLife.Draw(spriteBatch, gameTime);

            //respawnBuffer--;

            if (GameStateMachine.Instance.RespawnBuffer <= 0)
            {
                GameStateMachine.Instance.RespawnBuffer = GameValues.GameStateRespawnBuffer;
                GameStateMachine.Instance.GameState = new PlayingState();

                CheckPoint latestCheckPoint = new CheckPoint(new Vector2(0, 0));

                // Determines the furthest checkpoint achieved and makes that our latestCheckPoint, otherwise disables the rest.
                foreach (CheckPoint checkpoint in Level.Instance.Checkpoints)
                {
                    if (checkpoint.CheckPointEnabled == true && checkpoint.Position.X >= latestCheckPoint.Position.X)
                    {
                        latestCheckPoint = checkpoint;
                    }
                    else
                    {
                        checkpoint.CheckPointEnabled = false;
                    }

                }

                Level.Instance.Reset();
                HUD.Instance.ResetTime();

                // This check has to take place after Level.Instance.Reset() otherwise Mario does not reset correctly on
                // on the respawn and neither does the barrier.
                if (latestCheckPoint.CheckPointEnabled)
                {
                    Mario.Instance.Position = latestCheckPoint.Position;
                    Level.Instance.InvisibleBarrier.Position = new Vector2(latestCheckPoint.Position.X - 96, latestCheckPoint.Position.Y);
                }
            }
            else
            {
                GameStateMachine.Instance.RespawnBuffer--;
            }
        }
 void Awake() {
     instance = this;
     characterStatusList = new List<CharacterStatus>();
     characters = new List<GameObject>();
     activeCheckPoint = initialCheckPoint.GetComponent<CheckPoint>();
     for (int i = 0 ; i < characterList.Count ; i++) {
         characterStatusList.Add(characterList[i].GetComponent<CharacterStatus>());
         characters.Add(characterList[i]);
     }
     activeCharacter = characterList[0];
 }
 public override void Dispose()
 {
     this.entity = null;
     this.checkPoint = null;
     this.dtoGameTime = null;
     this.timeToCompleteMaze = null;
     this.mapExamMenu = null;
     this.pauseMenu = null;
     this.gameOverMenu = null;
     this.gameOverData = null;
     this.TotalGameTime = null;
     this.UserProfie = null;
     this.Walls = null;
     this.Weapons = null;
     base.Dispose();
 }
        public IEnumerable<UIAlertAction> GetAlertActionsForCheckpoint(CheckPoint selected,Action<Command> handler,iNavigatableDialog dialog=null)
        {
            var commands = this.Commands.AsEnumerable();

            if (dialog != null)
                commands = commands.Where(c=>c.Key!="Edit");

            return commands
                .Select(c=>c.Value)
                .Where (c => c.ShouldDecorate (selected))
                .Select(c=>{
                    if(c is IDialogBoundCommand  && dialog!=null)
                        ((IDialogBoundCommand)c).ExistingDialog=(iNavigatableDialog)dialog;
                    return c;
                })
                .Select (c => c.AsAlertAction (InstrumentationDecorator("Alert",c,selected,tc=>handler(tc))));
        }
        public OccurrencesSection(CheckPoint checkpoint,iCheckpointCommandController Controller,CheckPointDetailDialog dialog)
        {
            this.Caption= "Completions:";
            this.Footer = "Tap to remove.";

            var occurenceElements =
                checkpoint
                    .AllOccurrences
                    .OrderByDescending (o => o.TimeStamp)
                    .Select (o => new StringElement (o.Date.ToString ("d")  + (o.IsSkipped?" (Skipped)":""),
                        ()=>{
                            var c = SharedDialogs.ConfirmationDialog(
                                (a)=>
                                {
                                    checkpoint.RemoveOccurrence(o);
                                    Controller.RewriteOccurrences();
                                    dialog.Render();
                                },Message:"Deleting this completion will affect averages and streaks.");
                            dialog.PresentModalViewController(c,true);
                        })
                        {
                            Value= o.TimeStamp.ToString ("t")
                        })
                    .ToList();
            this.AddAll (occurenceElements.Take(5));

            if (occurenceElements.Count > 5)
                this.Add (new StringElement ("All Completions",
                    ()=>{
                        var r = new RootElement(checkpoint.Name);
                        var s = new Section("All Completions");
                        r.Add(s);
                        s.AddAll(
                            occurenceElements.Select(o=>
                                {
                                    o.Tapped+=()=>
                                    {r.Reload(s,UITableViewRowAnimation.Automatic);};
                                    return o;
                                }
                            ));
                        dialog.moreDialog = new DialogViewController(r,true);
                        dialog.NavigationController.PushViewController(dialog.moreDialog,true);
                    }
                ){ Alignment = UITextAlignment.Center });
        }
Exemple #45
0
 public diary(DateTime today)
 {
     date = today.Date;
     weather = 9;
     mood = 4;
     title[0] = "最开心的事";
     title[1] = "最悲剧的事";
     title[2] = "助人为乐";
     title[3] = "感悟";
     title[4] = "新闻";
     title[5] = "吃货美食";
     title[6] = "运动成果";
     title[7] = "进步";
     for (int i = 0; i < 8; i++)
     {
         content[i] = "";
     } 
     for (int i = 0; i < 5; i++)
     {
         checkPoint[i] = new CheckPoint();
     }
 }
 // Use this for initialization
 void Awake()
 {
     checkpointSoundString = "Prefabs/Effects/CoinSound2";
     checkPoint = GameObject.Find ("CheckPoints").GetComponent<CheckPoint> ();
 }
 public override bool ShouldDecorate(CheckPoint toDecorate)
 {
     return toDecorate.IsEnabled;
 }
 public override bool ShouldDecorate(CheckPoint toDecorate)
 {
     return !base.ShouldDecorate(toDecorate);
 }
 public virtual bool ShouldDecorate(CheckPoint toDecorate)
 {
     return true;
 }
 public virtual bool ExecuteFor(iCheckpointCommandController controller, CheckPoint checkPoint)
 {
     throw new NotImplementedException ();
 }
	/// <summary>
	/// When the player respawns, we reinstate this agent.
	/// </summary>
	/// <param name="checkpoint">Checkpoint.</param>
	/// <param name="player">Player.</param>
	public virtual void onPlayerRespawnInThisCheckpoint (CheckPoint checkpoint, CharacterBehavior player)
	{
		_direction = _initialDirection;
		transform.localScale= _initialScale;
		transform.position=_startPosition;
		gameObject.SetActive(true);
	}
 public void Add(CheckPoint newCP)
 {
     baseList.Add(newCP);
 }
 public CheckPointPair(CheckPoint first, CheckPoint second)
 {
     this.firstEvent = first;
     this.secondEvent = second;
 }
Exemple #54
0
        public CheckPoint Mark()
        {
            Stopwatch watch = Stopwatch.StartNew();
            _marks.Add(watch);

            var point = new CheckPoint(watch);

            return point;
        }
        private void ShowCustomAddDialog(CheckPoint existing = null)
        {
            var d = new CheckPointEditingDialog(this.Manager, new RootElement("Add..."), true);

            if (existing != null)
            {
                existing.UniqueIdentifier = Guid.NewGuid();
                existing.CreatedOn = DateTime.Now;
                d.RenderForCheckPoint(existing);
            }

            Manager.NavigateToDialog(d);
        }
 public static SCheckPoint Create(HttpContextBase context, CheckPoint checkPoint, Culture culture, bool details)
 {
     if (checkPoint == null) return null;
     return new SCheckPoint(checkPoint, Create(context, checkPoint.Place, culture, details));
 }
 public CheckPointCellSection(CheckPoint checkpoint)
 {
     var tableCell = new CheckPointElement (checkpoint);
     this.Caption = "Goal:";
     this.Add (tableCell);
 }
        CheckPointTableCell CheckPointTableCellFactory(UITableView tableView, CheckPoint checkpoint)
        {
            var cell = tableView.DequeueReusableCell (CheckPointTableCell.Key) as CheckPointTableCell;

            if (cell == null)
                cell = new CheckPointTableCell ()
                    {Delegate = this.Controller.UtilityButtonHandler};

            cell.RenderCheckpoint (checkpoint);
            Controller.Commands.AttachUtilityButtonsToCell (cell);
            return cell;
        }
 public void OnPlayerRespawnInThisCheckpoint(CheckPoint checkpoint, Player player)
 {
     _isCollected = false;
     _sprite.enabled = true;
 }
 public override bool ExecuteFor(iCheckpointCommandController controller, CheckPoint checkPoint)
 {
     checkPoint.IsEnabled = false;
     return true;
 }