Example #1
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     sprite = this.gameObject.GetComponent <SpriteRenderer>();
     rb     = gameObject.GetComponent <Rigidbody2D>();
     story  = GameObject.FindGameObjectWithTag("Story").GetComponent <GameStory>();
 }
Example #2
0
 void CheckStory()
 {
     story = GetComponent <GameStory>();
     if (story == null)
     {
         story = gameObject.AddComponent <GameStory>();
     }
 }
Example #3
0
        public void Run()
        {
            Screen.SetScreenSize(41, 120);
            PlaySound("../../Core/Resources/music/menuMusic.wav");

            while (true)
            {
                GameStory.printTitle();
                if (Console.KeyAvailable)
                {
                    break;
                }
                Thread.Sleep(1000);
                Console.Clear();
                GameStory.printTitle2();
                if (Console.KeyAvailable)
                {
                    break;
                }
                Thread.Sleep(1000);
                Console.Clear();
            }
            Console.Clear();

            GameStory.printMenu();

            int choice = int.Parse(Console.ReadLine());

            switch (choice)
            {
            case 1:
                IPlayer offlinePlayer = InvadersFactory.Instance.CreatePlayer();
                IEnemy  enemy         = InvadersFactory.Instance.CreateEnemy();
                Instance.PlayOffline(offlinePlayer);
                break;

            case 2:
                IClient client = InvadersFactory.Instance.CreateInvadersClient();
                client.ConnectClient();
                Instance.PlayOnline(client);
                break;

            case 3:
                Environment.Exit(0);
                return;

            default:
                break;
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            //Initializing
            GameIntroduction.ArtIntro();
            Location.CreateMap();
            GameStory.CreateStory();
            CurrentLocation = Location.Crossroad;
            //Initialization done

            Console.WriteLine("\n \n \n");
            Console.WriteLine("Would you like to play?");
            Console.WriteLine("'Yes' or 'No'?");
            Console.WriteLine("\n");

            var UserInput = Console.ReadLine().ToUpper();

            if (UserInput == "YES")
            {
                ConsoleClear();
                Introduction.StoryIntroduction();

                while (true)
                {
                    UserInput = Console.ReadLine().ToUpper();

                    if (UserInput == "HELP")
                    {
                        Commands.Help();
                    }
                    if (UserInput == "SEARCH")
                    {
                        Commands.Search();
                    }
                    if (UserInput == "LOCATION")
                    {
                        Commands.LocationInformation();
                    }
                    if (UserInput == "MOVE")
                    {
                        Commands.Move();
                    }
                }
            }
        }
Example #5
0
        static public void Boss(CharacterClass character) // Done
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();

            character.SpecialAttackCounter = 0;
            bool battleOutCome = false;

            if (character.BossEncounter > 3)
            {
                Console.WriteLine("There are no more Bosses you are done, get of the island...");
            }
            else
            {
                // background music choice
                if (character.BossEncounter < 3)
                {
                    player.SoundLocation = Environment.CurrentDirectory + @"\Perfect Thunder Storm.wav";
                    player.PlayLooping();
                }
                else
                {
                    player.SoundLocation = Environment.CurrentDirectory + @"\LastBossFight.wav";
                    player.PlayLooping();
                }


                Boss bossEncounter = new Boss(1, character.BossEncounter);
                battleOutCome = Battle(bossEncounter, character, 3);

                if (battleOutCome)
                {
                    player.Stop();
                    GameStory.StoryMiddle(character.BossEncounter, character);
                    character.BossEncounter++;
                }
                else
                {
                    Console.WriteLine("Come back when you are stronger..!");
                }
            }
            player.Stop();
        }
Example #6
0
        public void PlayOnline(IClient client)
        {
            IPlayer       currentPlayer;
            IPlayer       opponent;
            List <IEnemy> enemies;

            while (true)
            {
                Console.Clear();
                Console.CursorVisible = false;

                // Read GameObjects from server and print
                ReceiveSerializedList(client);
                currentPlayer = (IPlayer)gameObjects[0];
                opponent      = (IPlayer)gameObjects[1];
                enemies       = (List <IEnemy>)gameObjects[2];

                // Game end -----------
                if (opponent.Health == 0)
                {
                    GameStory.printGameComplete();
                    break;
                }
                else if (currentPlayer.Health == 0)
                {
                    GameStory.printGameOver();
                    break;
                }

                Instance.MirrorOpponent(opponent);
                Screen.PrintStats(currentPlayer, opponent);
                currentPlayer.ShootedBullets.ForEach(Screen.PrintObject);
                Screen.PrintObject(currentPlayer);
                Screen.PrintObject(opponent);
                enemies.ForEach(Screen.PrintObject);

                int pressedKey = ReadPressedKey();
                client.SendData(pressedKey.ToString());

                Thread.Sleep(100);
            }
        }
Example #7
0
        static void Main(string[] args)
        {
            Console.Title = "Welcome To stranded";
            Vendor localVendor = new Vendor();
            string menuChoice  = "";

            do
            {
                Console.Clear();

                Console.WriteLine("\n\n\n\n");
                Console.WriteLine("Welcome".PadLeft(55));
                Console.WriteLine("");
                Console.WriteLine("1. Story Mode".PadLeft(58));

                Console.WriteLine("0. Quit Game!".PadLeft(58));
                menuChoice = Console.ReadLine();
                switch (menuChoice.ToLower())
                {
                case "1":
                    Console.Clear();
                    GameMenu(GameStory.StoryStart(), localVendor);
                    menuChoice = "0";
                    break;

                case "god mode":     // CHEAT !!!!
                    CharacterClass character = new CharacterClass("James The Great", 3);
                    character.Gold      = 100000;
                    character.MaxHealth = 10000;
                    character.Health    = 10000;
                    character.MainQuest = "Find the Princess";
                    GameMenu(character, localVendor);
                    break;

                case "0":

                default:
                    break;
                }
            } while (menuChoice != "0");
        }
Example #8
0
 public override GameFrameStory Interact()
 {
     if (Flags.PrincessKidnapped)
     {
         if (GaveFish)
         {
             GameStory = base.Interact();
         }
         else
         {
             GameStory = ReadStory("master_pre_fishes.ink");
             var fishCount = Flags.FishCount;
             GameStory.ChoosePathString("dialog");
             GameStory.SetVariableState("fish_count", fishCount);
         }
     }
     else
     {
         GameStory = ReadStory("master_pre_kidnapping.ink");
     }
     return(GameStory);
 }
Example #9
0
        public override GameFrameStory Interact()
        {
            var scriptName = Flags.LearnedFight ? "north_guard_post_fight.ink" : "north_guard_pre_fight.ink";

            GameStory = ReadStory(scriptName);
            if (Flags.LearnedFight)
            {
                GameStory.ChoosePathString("dialog");
                CompleteEvent completeEvent = victory =>
                {
                    if (victory)
                    {
                        var collision = _collision.Invoke(Position.ToPoint(), EndPosition.ToPoint());
                        var endPoint  = collision ? _alternativeEndPoint : EndPosition;
                        MoveDelegate?.Invoke(this, endPoint.ToPoint());
                        GameFlags.SetVariable(FlagName, true);
                        AlreadyMoved = true;
                    }
                };
                ReadStory(GameStory, completeEvent);
            }
            return(GameStory);
        }
Example #10
0
 public override void CompleteInteract()
 {
     if (Flags.PrincessKidnapped)
     {
         if (GaveFish)
         {
             var preStoryOver = StoryOver;
             base.CompleteInteract();
             if (StoryOver && !preStoryOver)
             {
                 GameFlags.SetVariable("learned_fight", true);
             }
         }
         else
         {
             GaveFish = GameStory.GetVariableState <int>(GaveFishVariable) == 1;
             if (GaveFish)
             {
                 GameFlags.SetVariable(GaveFishVariable, GaveFish);
                 Flags.FishCount -= 3;
             }
         }
     }
 }
Example #11
0
        public override GameFrameStory Interact()
        {
            GameStory = ReadStory(ScriptName);
            GameStory.ChoosePathString("dialog");
            CompleteEvent completeEvent = win =>
            {
                if (win)
                {
                    var collision = _collision.Invoke(Position.ToPoint(), EndPosition.ToPoint());
                    var endPoint  = collision ? _alternativeEndPoint : EndPosition;
                    MoveDelegate?.Invoke(this, endPoint.ToPoint());
                    GameFlags.SetVariable(FlagName, true);
                    AlreadyMoved = true;
                }
                var dialog      = win ? "victory.ink" : "defeat.ink";
                var storyScript = StoryImporter.ReadStory(dialog);
                var newStory    = new GameFrameStory(storyScript);
                newStory.Continue();
                _say.Invoke(newStory);
            };

            ReadStory(GameStory, completeEvent);
            return(GameStory);
        }
Example #12
0
        static public void GameMenu(CharacterClass character, Vendor vendor)
        {
            string inputAnswer = "";

            do
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine(AsciiArt.MainHeading());
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("-------------------------------------".PadLeft(58));
                Console.WriteLine("|     Main Menu                     |".PadLeft(58));
                Console.WriteLine("-------------------------------------".PadLeft(58));
                Console.WriteLine("|     Where to next:                |".PadLeft(58));
                Console.WriteLine("|     1. City                       |".PadLeft(58));
                Console.WriteLine("|     2. Adventure Menu             |".PadLeft(58));
                Console.WriteLine("|     3. Character Information      |".PadLeft(58));
                Console.WriteLine("|                                   |".PadLeft(58));
                Console.WriteLine("|     9. Try and leave island       |".PadLeft(58));
                Console.WriteLine("|     0. Quit Game                  |".PadLeft(58));
                Console.WriteLine("|                                   |".PadLeft(58));
                Console.WriteLine("-------------------------------------".PadLeft(58));

                Console.SetCursorPosition(27, 18);
                inputAnswer = Console.ReadLine();
                switch (inputAnswer)
                {
                case "1":

                    CityMenu.InCityMenu(character, vendor);
                    break;

                case "2":

                    Adventure.AdventureMenu(character);

                    break;

                case "3":
                    Console.Clear();
                    Console.WriteLine(character.ClassPrintInformation());
                    Console.ReadKey();
                    break;

                case "9":
                    Console.Clear();
                    inputAnswer = GameStory.Ending(character);


                    break;

                case "0":
                    Console.Clear();
                    Console.WriteLine("Maybe be able to save.. then we have to have a menu in the biggining start game and load");
                    Console.ReadKey();
                    break;

                default:
                    break;
                }
            } while (inputAnswer != "0");
        }
 public RpgLogic(SessionStorage session)
 {
     _sessionstorage = session;
     _gamestory      = _sessionstorage.GameStory;
 }
Example #14
0
        public void PlayOffline(IPlayer offlinePlayer)
        {
            PlaySound("../../Core/Resources/music/singlePlayer.wav");

            List <IEnemy> enemies = new List <IEnemy>();
            IBoss         boss    = null;
            Random        rnd     = new Random();
            int           randX   = 0;
            int           counter = 0;

            while (true)
            {
                Console.Clear();
                Console.CursorVisible = false;

                offlinePlayer.ShootedBullets.RemoveAll(b => b.ObjectPosition.Y == 0);
                offlinePlayer.ShootedBullets.ForEach(Screen.PrintObject);
                offlinePlayer.ShootedBullets.ForEach(b => b.Move());

                randX = rnd.Next(0, Console.WindowWidth - 2);
                if (counter == 1000)
                {
                    Instance.GameSpeed = 20;
                    boss = InvadersFactory.Instance.CreateBoss(null, 10, null, ConsoleColor.Red, randX);
                    boss.ObjectPosition.Y = 1;
                    PlaySound("../../Core/Resources/music/bossMusic.wav");
                }
                else if (counter < 1000 && counter % 10 == 0)
                {
                    enemies.Add(InvadersFactory.Instance.CreateEnemy(null, 1, null, ConsoleColor.Green, randX));
                    Instance.GameSpeed++;
                }

                enemies.Remove(enemies.Find(i => i.ObjectPosition.Y == Console.WindowHeight));

                Screen.PrintObject(offlinePlayer);
                Screen.PrintStats(offlinePlayer);

                if (boss != null)
                {
                    if (counter % 5 == 0)
                    {
                        boss.Move();
                    }
                    boss.ShootedBullets.RemoveAll(bull => bull.ObjectPosition.Y == Console.WindowHeight);
                    boss.ShootedBullets.ForEach(b =>
                    {
                        Screen.PrintObject(b);
                        b.ObjectPosition.Y++;
                    });


                    Screen.PrintObject(boss);
                    HitCheck(offlinePlayer, null, null, boss);
                    Screen.PrintStats(offlinePlayer, null, boss);

                    if (boss.Health == 0)
                    {
                        Console.Clear();
                        GameStory.printGameComplete();
                        break;
                    }
                }

                enemies.ForEach(Screen.PrintObject);
                enemies.ForEach(p => p.Move());
                offlinePlayer.Move();

                Instance.HitCheck(offlinePlayer, enemies);

                // Game end -----------
                if (offlinePlayer.Health == 0)
                {
                    Console.Clear();
                    GameStory.printGameOver();
                    break;
                }

                counter++;
                Thread.Sleep(100 - Instance.GameSpeed);
            }
        }
Example #15
0
    // Use this for initialization

    void Awake()
    {
        story   = GameObject.FindGameObjectWithTag("Story").GetComponent <GameStory>();
        diary   = GameObject.FindGameObjectWithTag("Diary");
        enemies = GameObject.FindGameObjectsWithTag("Enemy").Length;
    }
Example #16
0
 void Awake()
 {
     story = GameObject.FindGameObjectWithTag("Story").GetComponent <GameStory>();
 }