public void MissionComplete()
    {
        CurrentMission.IsCompleted = true;
        var completedMission = CurrentMission.Clone() as MissionInfo;

        Debug.Log($"MissionCompleted: completedMission {completedMission.Level} nextMission {CurrentMission.Level} ");
        MissionCompleted(completedMission);
    }
Exemplo n.º 2
0
 public void InitializeMission(int missionID)
 {
     CurrentMissionID    = missionID;
     MissionPlanets      = new Dictionary <string, PlanetController>();
     CurrentMission      = GameObject.Instantiate(AvailableMissions[CurrentMissionID]);
     CurrentMission.Name = AvailableMissions[CurrentMissionID].name;
     CurrentMission.Initialize();
     PlayerController.Instance.transform.position = CurrentMission.PlayerPosition;
     InitializePlanetarySystems(ref CurrentMission.PlanetarySystems);
     InitializePlanets(ref CurrentMission.Planets);
     InitializeNpcs();
     DialogCanvasManager.Instance.midInfo.Show(CurrentMission.Name, ShowStartInfo);
     OnMissionInitialized?.Invoke();
 }
Exemplo n.º 3
0
        public string GetDescription(CurrentMission mission)
        {
            switch (mission)
            {
            case CurrentMission.Dark:
                return(Dark);

            case CurrentMission.Neutral:
                return(Neutral);

            case CurrentMission.Hero:
                return(Hero);

            default:
                throw new ArgumentOutOfRangeException(nameof(mission), mission, null);
            }
        }
Exemplo n.º 4
0
        public static void GenerateMission()
        {
            CurrentMission.active = false;
            Mission oldMission = null;
            Vector3 oldEndPos  = Vector3.Zero;

            if (CurrentMission != null)
            {
                oldMission = CurrentMission; // storing the old mission details
                oldEndPos  = oldMission.GetNewEndPos();
            }
            Random rnd   = new Random();
            int    index = rnd.Next(0, myList.Count); // create a random int between 0 and the total size of myList. to be used to grab a random position from myList.

            for (int i = 0; i < 100; i++)             // will try 100 times to find a new StartMission.
            {
                if (myList[index] != oldMission && myList[index].GetStartPos() != oldEndPos)
                {
                    CurrentMission = myList[index];
                    break;
                }
                else
                {
                    index = rnd.Next(0, myList.Count);
                }
            }
            index = rnd.Next(0, myList.Count);
            for (int i = 0; i < 100; i++)
            {
                if (myList[index] != CurrentMission && oldMission != myList[index] && myList[index].GetStartPos() != oldEndPos)
                {
                    CurrentMission.SetNewEndPos(myList[index].GetStartPos());
                    break;
                }
                else
                {
                    index = rnd.Next(0, myList.Count);
                }
            }
            if (oldEndPos != CurrentMission.GetNewEndPos() && oldMission != CurrentMission) // the deatils changed we can assume we have a new mission.
            {
                CurrentMission.active = true;
            }
        }
Exemplo n.º 5
0
    public static void GetCurrentMission()
    {
        if (!PlayerPrefs.HasKey(Current_mission_data_key))
        {
            PlayerPrefs.SetString(Current_mission_data_key, "Me-User-1");
        }
        if (dataCurrentMissionCache != null)
        {
            dataCurrentMissionCache = null;
        }
        string current_data = PlayerPrefs.GetString(Current_mission_data_key);

        string[] data = current_data.Split(',');
        dataCurrentMissionCache = new CurrentMission[data.Length];
        for (int i = 0; i < data.Length; i++)
        {
            string[] info = data[i].Split('-');
            //fb - User name -  missison
            dataCurrentMissionCache[i] = new CurrentMission(info[0], info[1], info[2]);
        }
    }
Exemplo n.º 6
0
        /// <summary>
        /// This method is quite ugly. The quality of it is the same as the edginess of this class.
        /// </summary>
        public static string GetDescription(StageID stageId, CurrentMission mission)
        {
            switch (stageId)
            {
            // 100
            case StageID.Westopolis:
                return(Westopolis.GetDescription(mission));

            // 200
            case StageID.DigitalCircuit:
                return(DigitalCircuit.GetDescription(mission));

            case StageID.GlyphicCanyon:
                return(GlyphicCanyon.GetDescription(mission));

            case StageID.LethalHighway:
                return(LethalHighway.GetDescription(mission));

            // 300
            case StageID.CrypticCastle:
                return(CrypticCastle.GetDescription(mission));

            case StageID.PrisonIsland:
                return(PrisonIsland.GetDescription(mission));

            case StageID.CircusPark:
                return(CircusPark.GetDescription(mission));

            // 400
            case StageID.CentralCity:
                return(CentralCity.GetDescription(mission));

            case StageID.TheDoom:
                return(TheDoom.GetDescription(mission));

            case StageID.SkyTroops:
                return(SkyTroops.GetDescription(mission));

            case StageID.MadMatrix:
                return(MadMatrix.GetDescription(mission));

            case StageID.DeathRuins:
                return(DeathRuins.GetDescription(mission));

            // 500
            case StageID.TheARK:
                return(TheArk.GetDescription(mission));

            case StageID.AirFleet:
                return(AirFleet.GetDescription(mission));

            case StageID.IronJungle:
                return(IronJungle.GetDescription(mission));

            case StageID.SpaceGadget:
                return(SpaceGadget.GetDescription(mission));

            case StageID.LostImpact:
                return(LostImpact.GetDescription(mission));

            // 600
            case StageID.GUNFortress:
                return(GunFortress.GetDescription(mission));

            case StageID.BlackComet:
                return(BlackComet.GetDescription(mission));

            case StageID.LavaShelter:
                return(LavaShelter.GetDescription(mission));

            case StageID.CosmicFall:
                return(CosmicFall.GetDescription(mission));

            case StageID.FinalHaunt:
                return(FinalHaunt.GetDescription(mission));
            }

            return("");
        }
 public bool IsCurrentMissionFullfilled()
 {
     CurrentMission.MissionModel = this.Model;
     return(CurrentMission.IsFulfilled());
 }