Exemple #1
0
        public object DOMParse(XmlElement element, params object[] parameters)
        {
            XmlElement tmpXmlElement;

            var completable = new Completable();

            completable.setId(element.GetAttribute("id"));

            completable.setRepeatable(element.GetAttribute("repeatable") == "true");

            switch (element.GetAttribute("type"))
            {
            case "combat": completable.setType(Completable.TYPE_COMBAT); break;

            case "completable": completable.setType(Completable.TYPE_COMPLETABLE); break;

            case "game": completable.setType(Completable.TYPE_GAME); break;

            case "level": completable.setType(Completable.TYPE_LEVEL); break;

            case "quest": completable.setType(Completable.TYPE_QUEST); break;

            case "race": completable.setType(Completable.TYPE_RACE); break;

            case "session": completable.setType(Completable.TYPE_SESSION); break;

            case "stage": completable.setType(Completable.TYPE_STAGE); break;

            case "storynode": completable.setType(Completable.TYPE_STORYNODE); break;

            default: completable.setType(Completable.TYPE_COMPLETABLE); break;
            }

            tmpXmlElement = (XmlElement)element.SelectSingleNode("start-milestone");
            if (tmpXmlElement != null)
            {
                completable.setStart(parseMilestone(tmpXmlElement, parameters));
            }

            tmpXmlElement = (XmlElement)element.SelectSingleNode("end-milestone");
            if (tmpXmlElement != null)
            {
                completable.setEnd(parseMilestone(tmpXmlElement, parameters));
            }

            tmpXmlElement = (XmlElement)element.SelectSingleNode("progress");
            if (tmpXmlElement != null)
            {
                completable.setProgress(parseProgress(tmpXmlElement, parameters));
            }

            tmpXmlElement = (XmlElement)element.SelectSingleNode("score");
            if (tmpXmlElement != null)
            {
                completable.setScore(parseScore(tmpXmlElement, parameters));
            }

            return(completable);
        }
        public void Awake()
        {
            instance = this;
            //Create Main game completable
            var trackerConfigs = Game.Instance.GameState.Data.getObjects <TrackerConfig>();

            PrepareTracker(trackerConfigs.Count == 0 ? new TrackerConfig() : trackerConfigs[0]);

            Completable mainGame = new Completable();

            Completable.Milestone gameStart = new Completable.Milestone();
            gameStart.setType(Completable.Milestone.MilestoneType.SCENE);
            gameStart.setId(Game.Instance.GameState.InitialChapterTarget.getId());
            mainGame.setStart(gameStart);
            mainGame.setId(Game.Instance.GameState.Data.getTitle());
            mainGame.setType(Completable.TYPE_GAME);

            Completable.Milestone gameEnd = new Completable.Milestone();
            gameEnd.setType(Completable.Milestone.MilestoneType.ENDING);
            mainGame.setEnd(gameEnd);

            Completable.Progress gameProgress = new Completable.Progress();
            gameProgress.setType(Completable.Progress.ProgressType.SUM);

            Completable.Score mainScore = new Completable.Score();
            mainScore.setMethod(Completable.Score.ScoreMethod.AVERAGE);

            var completables = Game.Instance.GameState.GetObjects <Completable>();

            foreach (Completable part in completables)
            {
                Completable.Milestone tmpMilestone = new Completable.Milestone();
                tmpMilestone.setType(Completable.Milestone.MilestoneType.COMPLETABLE);
                tmpMilestone.setId(part.getId());
                gameProgress.addMilestone(tmpMilestone);

                Completable.Score tmpScore = new Completable.Score();
                tmpScore.setMethod(Completable.Score.ScoreMethod.SINGLE);
                tmpScore.setType(Completable.Score.ScoreType.COMPLETABLE);
                tmpScore.setId(part.getId());
                mainScore.addSubScore(tmpScore);
            }
            mainGame.setProgress(gameProgress);
            mainGame.setScore(mainScore);

            completables.Insert(0, mainGame);

            SetCompletables(completables);

            Game.Instance.GameState.OnConditionChanged += (_, __) => ConditionChanged();
            Game.Instance.OnTargetChanged     += TargetChanged;
            Game.Instance.OnElementInteracted += ElementInteracted;
        }
Exemple #3
0
        // #########################################
        // ############### COMPLETABLES ############
        // #########################################



        private void InitCompletables()
        {
            //Create Main game completabl
            Completable mainGame = new Completable();

            Completable.Milestone gameStart = new Completable.Milestone();
            gameStart.setType(Completable.Milestone.MilestoneType.SCENE);
            gameStart.setId(Game.Instance.GameState.InitialChapterTarget.getId());
            mainGame.setStart(gameStart);
            mainGame.setId(Game.Instance.GameState.Data.getTitle());
            mainGame.setType(Completable.TYPE_GAME);

            Completable.Milestone gameEnd = new Completable.Milestone();
            gameEnd.setType(Completable.Milestone.MilestoneType.ENDING);
            mainGame.setEnd(gameEnd);

            Completable.Progress gameProgress = new Completable.Progress();
            gameProgress.setType(Completable.Progress.ProgressType.SUM);

            Completable.Score mainScore = new Completable.Score();
            mainScore.setMethod(Completable.Score.ScoreMethod.AVERAGE);

            completables = new List <Completable>(Game.Instance.GameState.GetObjects <Completable>());

            foreach (Completable part in completables)
            {
                Completable.Milestone tmpMilestone = new Completable.Milestone();
                tmpMilestone.setType(Completable.Milestone.MilestoneType.COMPLETABLE);
                tmpMilestone.setId(part.getId());
                gameProgress.addMilestone(tmpMilestone);

                Completable.Score tmpScore = new Completable.Score();
                tmpScore.setMethod(Completable.Score.ScoreMethod.SINGLE);
                tmpScore.setType(Completable.Score.ScoreType.COMPLETABLE);
                tmpScore.setId(part.getId());
                mainScore.addSubScore(tmpScore);
            }
            mainGame.setProgress(gameProgress);
            mainGame.setScore(mainScore);

            completables.Insert(0, mainGame);

            SetCompletables(completables);
        }