public override void OnObjectiveItemPickup(LevelObjective lvlObj, BaseObject item)
    {
        StickyItem obj = item as StickyItem;

        if (connectedItem != null && obj != null)
        {
            if (obj.UUID == connectedItem.UUID && connectedItem.UUID != -1)
            {
                connectedObjective = lvlObj;
                if (lvlObj.isMainObjective)
                {
                    completionSound = awardMain;
                }
                else
                {
                    completionSound = awardSide;
                }
                currentPickedUpItems++;
                if (currentPickedUpItems == (itemNumber))
                {
                    image.sprite = connectedItem.icon;
                    FadeOpen(false);
                }
            }
        }
    }
예제 #2
0
 public virtual void OnObjectiveComplete(LevelObjective lvlObj)
 {
     if (lvlObj.isMainObjective)
     {
         FadeBlack(CameraFadeCallBack);
     }
 }
예제 #3
0
    public void Save(ref Board board, ref Level level, string name, int progress, LevelObjective objective = LevelObjective.Eliminate)
    {
        int       step     = level == null ? progress : level.step;
        XDocument document = CreateDocument(ref board, ref level, step);

        document.Save("Assets/Resources/Levels/" + name + ".xml");
    }
예제 #4
0
 public void OnObjectiveComplete(LevelObjective lvlObj)
 {
     if (connectedGroceries.connectedObjective == lvlObj)
     {
         StopPointing();
     }
 }
 public void OnObjectiveComplete(LevelObjective lvlObj)
 {
     if (connectedGroceries.connectedObjective == lvlObj)
     {
         MoveMe();
     }
 }
 public void OnObjectiveComplete(LevelObjective lvlObj)
 {
     if (lvlObj == keysToApartment)
     {
         StartCoroutine("WinLevel");
     }
 }
예제 #7
0
 public virtual void OnObjectiveComplete(LevelObjective lvlObj)
 {
     if (lvlObj == connectedObjective)
     {
         image.sprite = connectedItem.icon;
     }
 }
 public OptionObjectiveSquare(Sprite spriteSheet, Vector2 position, LevelObjective state)
     : base(spriteSheet, position)
 {
     displaySprite     = spriteSheet.GetSubSprite(new Rectangle(50, 0, 12, 12));
     optionState       = state;
     readyToSetDisplay = false;
 }
 public OptionObjectiveEntry(Sprite spriteSheet, Vector2 position, LevelObjective objectiveType)
     : base(position)
 {
     squarePos.X  += 80;
     this.position = position;
     displayText   = objectiveType.ToString();
     optionSquare  = new OptionObjectiveSquare(spriteSheet, squarePos, objectiveType);
 }
예제 #10
0
 public void StartGame()
 {
     currentGame = new Game();
     currentGame.Initialize(LevelObjective.CreateDefaultLevel());
     _gameUI.Initialize(_pieceTypeDatabase);
     _gameUI.UpdateUI(currentGame);
     CreateBoard();
 }
예제 #11
0
        private void LoadLevelObjective(String loadPattern)
        {
            Match objectiveModeMatch = Regex.Match(loadPattern, @"^(\w+)|");

            objective = MathFunctions.ParseEnum <LevelObjective>(objectiveModeMatch.Value);
            Match objectiveValMatch = Regex.Match(loadPattern, @"([A-Z])(\d+)");

            objectiveValue = Convert.ToInt32(objectiveValMatch.Groups[2].Value);
        }
예제 #12
0
        public void finishLevel_DEVELOPONLY()
        {
            if (StatsManager.gameMode != GameMode.Develop && StatsManager.gameMode != GameMode.Campaign)
            {
                throw new ArgumentException("This function should ONLY be called for debug purposes // Jakob");
            }

            levelObjective      = LevelObjective.KillNumber;
            killCountForVictory = 0;
        }
예제 #13
0
        public override void ClickAction()
        {
            LevelObjective newObjective      = ActiveData.levelObjective;
            int            levelObjectiveInt = EventEditor.GetObjectiveInt(newObjective);

            if (levelObjectiveInt >= 0)
            {
                AddAction(new SetLevelObjectiveAction(newObjective, levelObjectiveInt));
            }
        }
예제 #14
0
 void OnLevelObjectiveCompleted(LevelObjective objective)
 {
     if (targetLevelObjectives.Contains(objective))
     {
         var winningTeam = objective.GetObjectiveOwner();
         Debug.Log("Objective " + objective.GetObjectiveType() + " achieved by " + winningTeam.name);
         isLevelCompleted = true;
         LevelEvents.levelWonEvent.Invoke(winningTeam);
     }
 }
예제 #15
0
        public static String GetObjectiveString()
        {
            LevelObjective currentObj = ActiveData.levelObjective;

            String returnString = currentObj.ToString() + "|";
            SortedDictionary <string, int> objectiveSettings = ExtractValueDictionary(masterObjectiveDictionary[currentObj]);

            returnString += GetSaveString(objectiveSettings);

            return(returnString);
        }
예제 #16
0
        private void UpdateObjectiveSettings(GameTime gameTime)
        {
            LevelObjective activeObjectiveType = ActiveData.levelObjective;

            ICollection <string> keys = masterObjectiveDictionary[activeObjectiveType].Keys;

            foreach (String key in keys)
            {
                masterObjectiveDictionary[activeObjectiveType][key].Update(gameTime);
            }
        }
예제 #17
0
 public void OnObjectiveItemPickup(LevelObjective lvlObj, BaseObject item)
 {
     if (lvlObj.AllItemsCollected)
     {
         peekTime = allCollectedPeekTime;
     }
     else
     {
         peekTime = normalPeekTime;
     }
     Peek();
 }
예제 #18
0
        public static int GetObjectiveInt(LevelObjective objective)
        {
            SortedDictionary <string, int> dict = ExtractValueDictionary(masterObjectiveDictionary[objective]);
            ICollection <int> values            = dict.Values;

            if (values.Count == 1)
            {
                return(values.ElementAt(0));
            }
            else
            {
                return(0);
            }
        }
예제 #19
0
    public void Save(ref Board board, string levelName, LevelObjective objective)
    {
        export = new LevelExporter();

        Level      level    = null;
        GameObject levelObj = GameObject.Find("Level");

        if (levelObj != null)
        {
            level = levelObj.GetComponent <Level>();
        }

        export.Save(ref board, ref level, levelName, -1, objective);
    }
예제 #20
0
    public void Update()
    {
        LevelObjective current = LevelManager.CurrentObjective;

        Anim.SetBool("Active", current != null);

        if (current != null)
        {
            float p = Mathf.Clamp01(current.GetProgress());
            Bar.fillAmount = Mathf.Lerp(Bar.fillAmount, p, Time.unscaledDeltaTime * LerpSpeed);

            Text.text = current.GetPrompt();
        }
    }
예제 #21
0
        protected Level(Game1 Game, Sprite spriteSheet, PlayerVerticalShooter player, MissionType missionType, String identifier)
        {
            this.Game       = Game;
            this.Identifier = identifier;

            border           = new Sprite(Game.Content.Load <Texture2D>("Vertical-Sprites/BorderSprite"), new Rectangle(5, 5, 1, 1));
            this.spriteSheet = spriteSheet;
            this.player      = player;
            random           = new Random();
            customStartTime  = -1;
            this.missionType = missionType;

            levelObjective = LevelObjective.Finish;
            winOnFinish    = true;
        }
예제 #22
0
 public void OnObjectiveComplete(LevelObjective lvlObj)
 {
     if (lvlObj == levelObjective)
     {
         if (particles != null)
         {
             particles.PlayOnce();
         }
         if (objectToSpawn != null)
         {
             GameObject go = Instantiate(objectToSpawn, transform.position, transform.rotation) as GameObject;
         }
         if (!shutUp)
         {
             audioPlayer.Play(completionSound);
         }
     }
 }
예제 #23
0
        //Called when new data is created from inside program
        public LevelData()
        {
            height           = 10;
            pointWidth       = 6;
            durationWidth    = 3;
            pointDataGrid    = new PointSquareData[pointWidth, height];
            durationDataGrid = new DurationSquareData[durationWidth, height];
            durationChains   = new List <DurationSquareDataChain>();
            objective        = LevelObjective.Finish;

            duration      = 10;
            widthInPixels = 400;

            CalculateTimeVector();

            InitializePointGridData();
            InitializeDurationGridData();
        }
예제 #24
0
    private void UpdateOverview()
    {
        if (Objectives.Count == 0 && Current == null)
        {
            Overview = "No remaining objectives.";
            return;
        }

        const char WHITESPACE = '\t';

        str.Clear();
        pending.Clear();
        int indent = 0;

        if (Current != null)
        {
            pending.Add(Current);
        }
        pending.AddRange(Objectives);

        LevelObjective current = pending[0];

        while (pending.Count > 0)
        {
            str.Append(WHITESPACE, indent);
            str.AppendLine(current.ToString().Trim());
            pending.Remove(current);

            bool comp = current is CompoundLevelObjective;
            if (comp)
            {
                pending.AddRange((current as CompoundLevelObjective).Requirements);
            }

            if (pending.Count > 0)
            {
                current = pending[0];
            }
        }

        Overview = str.ToString().TrimEnd();
    }
예제 #25
0
    protected override void LateAwake()
    {
        if (levelObjective == null)
        {
            levelObjective = GetComponent <LevelObjective>();
            if (levelObjective == null)
            {
                Debug.Log("I need an objective to fulfil my purpose :(");
                return;
            }
        }
        audioPlayer = GetComponent <AudioPlayer>();

        if (particles != null)
        {
            GameObject go = Instantiate(particles.gameObject, transform.position, transform.rotation) as GameObject;
            go.transform.parent = transform;
            particles           = go.GetComponent <ParticleEffect>();
        }
    }
예제 #26
0
    public virtual void OnObjectiveItemPickup(LevelObjective lvlObj, BaseObject item)
    {
        StickyItem obj = item as StickyItem;

        if (connectedItem != null && obj != null)
        {
            if (obj.UUID == connectedItem.UUID && connectedItem.UUID != -1)
            {
                connectedObjective = lvlObj;
                if (lvlObj.isMainObjective)
                {
                    completionSound = awardMain;
                }
                else
                {
                    completionSound = awardSide;
                }
                image.sprite = connectedItem.icon;
                FadeOpen(false);
            }
        }
    }
예제 #27
0
    void Start()
    {
        manager = GameObject.FindObjectOfType <LevelManager>();

        objectiveMethods = new Dictionary <Objective, LevelObjective>();
        objectiveMethods.Add(Objective.GetItems, GetItems);
        objectiveMethods.Add(Objective.PassLevel, PassLevel);
        objectiveMethods.Add(Objective.Time, TimeChallenge);
        objectiveMethods.Add(Objective.ObjectiveNotImplemented, objectiveNotImplemented);
        objectiveMethods.Add(Objective.WhaleSeen, PassLevel);
        objectiveMethods.Add(Objective.Refueled, isCopterRefueled);
        objectiveMethods.Add(Objective.DiverInCargo, isDiverInCargo);
        objectiveMethods.Add(Objective.DryCat, isCatDry);
        objectiveMethods.Add(Objective.MultipleCratesHooked, multipleCratesHooked);
        objectiveMethods.Add(Objective.NoThrowsMissed, noMissedThrows);
        objectiveMethods.Add(Objective.ChainFishermen, fishermenChained);
        objectiveMethods.Add(Objective.shipNotHit, shipNotHit);


        LevelObjective1 = objectiveMethods[Objective1];
        LevelObjective2 = objectiveMethods[Objective2];
        LevelObjective3 = objectiveMethods[Objective3];
    }
 public SetLevelObjectiveAction(LevelObjective objective, int objectiveInt)
     : base()
 {
     this.objective    = objective;
     this.objectiveInt = objectiveInt;
 }
 public void OnObjectiveItemPickup(LevelObjective lvlObj, BaseObject item)
 {
 }
예제 #30
0
    void OnLevelWasLoaded(int level)
    {
        if (level == 0) {
            Cursor.visible = true;
            Destroy(gameObject);
        }

        GameState.SetLastLevel(howManyLevels);

        #if !UNITY_EDITOR
                    Cursor.visible = false;
        #endif

        if (!initialized && level != 0) {
            am = gameObject.GetComponent<AnnouncementManager>();
            cm = gameObject.GetComponent<CharacterManager>();
            em = gameObject.GetComponent<EnemyManager>();
            uim = GameObject.Find("UserInterface").GetComponent<UserInterfaceManager>();

            objective = GameObject.Find("LevelLoader").GetComponent<LevelLoader>().levelObjective;
            am.InformLevelObjective(objective);

            initialized = true;
            levelCompleted = false;
            am.LevelLoadedFader();
            Invoke("LateStart", 0.1f);
        }
    }
예제 #31
0
 public void SetDisplay(LevelObjective newObjective, Vector2 pos)
 {
     ActiveData.levelObjective = newObjective;
     markerPosition            = pos;
 }
예제 #32
0
 public void SetLevelObjective(LevelObjective obj)
 {
     objective = obj;
 }
 public void InformLevelObjective(LevelObjective obj)
 {
     if (obj == LevelObjective.KillYourCharacters) {
         levelStartTime = Time.time;
         charactersAreEnemies = true;
         lastLevelTipNeeded = true;
     } else {
         charactersAreEnemies = false;
     }
     if (GameState.GetLevel() > 1) {
         GetComponent<AudioSource>().enabled = true;
     }
 }