static void Main(string[] args)
        {
            Stats s = new Stats();

            Player p = new Player("Tuukka Hellman");
            Potion po = new Potion();
            object obj = new object();

            Hero h = new Hero();

            p.

            // Sama kuin IncrementWins

            for (int i = 0; i < 2; i++)
            {
               s.increase(Stats.Kind.Wins);
            }

            for (int i = 0; i < 4; i++)
            {
              s.increase(Stats.Kind.Ties);
            }

            for (int i = 0; i < 8; i++)
            {
               s.increase(Stats.Kind.Losses);
            }

            /*
            Console.WriteLine(s.GetWinPercentage());
            Console.WriteLine(s.GetLossPercentage());
            Console.WriteLine(s.GetTiePercentage());
            */
        }
Exemple #2
0
        public KinectPlayer(Vector3 platformData)
        {
            JumpLeft = false;
            progressBarBackground = new Sprite();
            progressBarBackground.Rectangle = new Rectangle(0,0,GameConstants.HorizontalGameResolution,GameConstants.VerticalGameResolution/80);
            progressBarFrame = new Sprite();
            progressBarFrame.Rectangle = new Rectangle(0,0,GameConstants.HorizontalGameResolution,GameConstants.VerticalGameResolution/80);
            newGameCounter = new Stopwatch();
            newGameCounter.Reset();

            nyanSprite = new Sprite();
            nyanSprite.Rectangle = new Rectangle(-(int)GameConstants.nyanDimensions.X, (int)GameConstants.VerticalGameResolution/25, (int)GameConstants.nyanDimensions.X, (int)GameConstants.nyanDimensions.Y);

            progressBarRectangle=new Rectangle(0,0,GameConstants.HorizontalGameResolution,GameConstants.VerticalGameResolution/80);
            progressBarTextures = new Texture2D[3];
            modelPosition = new Hero(new ObjectData3D
                                      {
                                          Scale = new Vector3(GameConstants.HeroScale),
                                          Rotation = new Vector3(0.0f)
                                      });

            currentStance = GameConstants.PlayerStance.GameSettingsSetup;
            lastStance = GameConstants.PlayerStance.GameSettingsSetup;
            isMotionCheckEnabled = true;
            modelGroundLevel = platformData.Y+GameConstants.PlayerModelHeight;
            modelPosition.objectArrangement.Position = new Vector3(platformData.X,modelGroundLevel,platformData.Z);
            modelPosition.oldArrangement = modelPosition.objectArrangement;
            currentModel = modelUp;
        }
Exemple #3
0
        /**
         * Initialisation of the game
         * Generation of the scene from the level file
         */
        void Start()
        {
            //GameModel.Init();
            GameModel.resetDataBeforeLevel ();

            level = GameModel.ActualLevel;

            //Debug.Log (level.Name);

            //Debug.Log ("START Start GameController");

            //recupération des options
            handSide = HandSide.RIGHT_HAND;

            //lire fichier niveau
            //LevelParser parser = new LevelParser (FILE_PATH);

            //génération du héros

            //instanciate a hero using the class contained in the model
            Hero modelHero = GameModel.Hero;
            string heroClass = modelHero.GetType ().ToString ();

            if (heroClass == "Warrior")
            heroGameObject = Instantiate (warrior);
            else if (heroClass == "Monk")
            heroGameObject = Instantiate (monk);
            else if (heroClass == "Wizard")
            heroGameObject = Instantiate (wizard);
            else
            heroGameObject = Instantiate (warrior);

            //Debug.Log (heroGameObject);
            GameModel.HerosInGame.Add (heroGameObject.GetComponent<Hero> ());
            hero = GameModel.HerosInGame [0];
            float vitesseHeros = hero.MovementSpeed;
            hero.XpQuantity = modelHero.XpQuantity;

            //LEAP
            leapInstance = Instantiate (leapPrefab);
            //Debug.Log ("leapInstance : " + leapInstance);
            //the leap motion scene is child of camera so it follow the translation
            leapInstance.transform.parent = Camera.allCameras[0].transform;
            leapInstance.transform.position = new Vector3 (0f, 2.5f, 1.6f);
            //sets the "hand parent" field so the arms also are child of camera and don't flicker
            leapControl = leapInstance.GetComponent<HandController> ();
            leapControl.setModel(handSide, hero);
            leapControl.setGameController(this);

            leapControl.handParent = Camera.allCameras[0].transform;

            leapCanvas = Instantiate(leapCanvasPrefab);

            //Génération de terrain
            float longueurTerrain = vitesseHeros * tempsMusique;

            /*ter = Instantiate( terrain, new Vector3(0,0,0), Quaternion.identity) as GameObject;
            ter.transform.Rotate (0, -90, 0);
            ter.transform.localScale = new Vector3 (longueurTerrain, 1, 1);
            */
            ter = Instantiate (terrain, new Vector3 (-100, -2, 0), Quaternion.identity) as Terrain;
            //ter.terrainData.size = new Vector3 (1.0f, 1.0f, 1.0f);
            //ter.terrainData.size = new Vector3 (200, 200, 1);

            //génération des ennemis
            npcList = new List<GameObject> ();
            //Debug.Log (npcList);

            //List<Thing> ennemies = parser.getEnnemies ();
            List<Item> items = level.ItemList;
            //Debug.Log ("FINAL ITEM LIST COUNT : " + items.Count);

            foreach (Item item in items) {
            GameObject go = null;

            if (item.Type == "basicLancer")
                go = basicLancer;
            else if (item.Type == "fireLancer")
                go = fireLancer;
            else if (item.Type == "iceLancer")
                go = iceLancer;
            else if (item.Type == "basicDragonet")
                go = basicDragonet;
            else if (item.Type == "fireDragonet")
                go = fireDragonet;
            else if (item.Type == "iceDragonet")
                go = iceDragonet;
            else if (item.Type == "wall")
                go = wall;
            else if (item.Type == "cannon")
                go = canon;
            else if (item.Type == "assassin")
                go = assassin;
            else if (item.Type == "life")
                go = lifePotion;
            else if (item.Type == "power")
                go = powerPotion;
            else if (item.Type == "invincibility")
                go = invincibilityPotion;

            if (go != null){
                GameObject instance = Instantiate(go, new Vector3(item.PositionInX, go.transform.localScale.y/2, vitesseHeros*item.PositionInSeconds), Quaternion.identity) as GameObject;
                NPC npc = instance.GetComponent<NPC>();

                if (npc != null)
                    GameModel.NPCsInGame.Add(npc);
                //GameModel.NPCsInGame[GameModel.NPCsInGame.Count-1].transform.Rotate(0, 180, 0);
            }
            }

            //Génération du HUD
            hudMaster = Instantiate (hud).GetComponent<HudMaster>();
            //Debug.Log ("hudMaster : " + hudMaster);
            state = GameState.PLAY;

            Camera.main.transform.parent = heroGameObject.transform;
            Camera.main.transform.position = new Vector3 (0, 2.18f, 0);
            //Camera.main.transform.Translate(new Vector3(0, 2.18f, 0));

            pausedMenu = GameObject.Find("Canvas");
            pausedMenu.SetActive(false);
            paused = false;

            Time.timeScale = 1.0f;

            musicCanvas = Instantiate (musicCanvasPrefab);
            audioManager = musicCanvas.GetComponent<AudioManager> ();

            audioManager.SetMusicName (level.MusicPath);
            audioManager.Init ();

            //If leap is not connected, Pause game and show warning message
            if ( !leapControl.IsConnected())
            {
            //pause()
            audioManager.Pause();
            Time.timeScale = 0.0f;

            GameObject detectedCanvas = GameObject.Find("DetectedLeapCanvas");
            detectedCanvas.GetComponent<Canvas>().enabled = true;
            }

            //Debug.Log ("END Start GameController");

            //ADD TUTORIAL MANAGER

            if (level.Tutorial) {
            GameObject tutoGO = Resources.Load("prefabs/controllers/TutorialManager") as GameObject;
             	Instantiate (tutoGO);
            }
        }
Exemple #4
0
 public virtual void Attack(Hero defender)
 {
 }
Exemple #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.IsFullScreen = false;
            IsMouseVisible = true;
            graphics.ApplyChanges();

            cameraPosition = new Vector3(0.0f, 5.0f, 10.0f);
            moveOnlyOnceRight = true;
            moveOnlyOnceLeft = true;
            mainMenu = new MainMenu(graphics);

            platformList = new List<Platform>();
            platformGenerator=new PlatformCollection();
            var heroArrangement = new ObjectArrangementIn3D
                                      {
                                          Position = new Vector3(0.0f, 0.5f, 9.0f),
                                          Scale = new Vector3(0.5f, 0.5f, 0.5f),
                                          Rotation = new Vector3(0.0f)
                                      };
            player = new Hero(heroArrangement);

            CreatePlatforms(PlatformCount, FirstPlatformPosition, DistanceBetweenPlatforms);

            base.Initialize();
        }
Exemple #6
0
        public static void Main()
        {
            Console.WriteLine("One day you are at your desk working on some code.");
            Console.WriteLine("You decide to take a break to get a quick snack.");
            Console.WriteLine("As you walk into the kitchen the lights go out!");
            Console.WriteLine("Then you hear a hissing sound coming from the refrigerator.");

            Hero hero = new Hero();

            Console.WriteLine("A mysterious unfriendly voice from the darkness asks you.");
            Console.WriteLine("What is your name human?!");

            hero.heroName = Console.ReadLine();

            Console.WriteLine("Think quick what are you going to do {0}???", hero.heroName);
            Console.WriteLine("You are very afraid and tired from coding all night.");

            hero.lives = 3;

            Console.WriteLine("You remember that you only have {0} lives in you.", hero.lives);
            Console.WriteLine("You see an odd figure standing in front of you...");
            Console.WriteLine("You look around and see 3 items you can use as weapons");

            //Weapons weapon = new Weapons();
            string[,] weapons1 = new string[3, 2] {
                { "Torch (it)", "1000" }, { "Freeze Ray (make harder)", "100" }, { "Candle (burn with prayers)", "500" }
            };
            string[,] weapons2 = new string[3, 2] {
                { "Toothpick (poker face)", "1000" }, { "Vodka (martini)", "100" }, { "Mouth (smash)", "500" }
            };
            string[,] weapons3 = new string[3, 2] {
                { "Spoon (her)", "1000" }, { "Whip Cream (on it)", "100" }, { "Fork (it)", "500" }
            };
            string[,] weapons4 = new string[3, 2] {
                { "ChopSticks", "1000" }, { "Wasabi", "100" }, { "Soy Sauce", "500" }
            };

            Alien alien = new Alien();

            alien.healthPoints = 1000;

            Alien alien1 = new Alien();

            //alien1.healthPoints = 1000;
            alien1.alienName = "Patrick the Dry Ice Cube";
            alien1.strenght  = new string[1] {
                "Freeze (make harder)"
            };
            alien1.weakness = new string[2] {
                "Torch (it)", "Candle (burn with prayers)"
            };
            alien1.endMessage = "After you took care of the dastardly Dry Ice Cube, you need a quick drink to calm your nerves.  You already have some ice, so why not.  You reach for the olives and suddenly an old dry olive jumps out at you. ";

            Alien alien2 = new Alien();

            //alien2.healthPoints = 1000;
            alien2.alienName = "Gaga the Dry Olive";
            alien2.strenght  = new string[1] {
                "Vodka (martini)"
            };
            alien2.weakness = new string[2] {
                "Toothpick (poker face)", "Mouth (smash)"
            };
            alien2.endMessage = "Applause to you!  You have dodged a bad romance with that lil’ monster.  Never mind the drink, how about something sweet?  You reach for some ice cream in the freezer, coast is clear, now for some cherries and nuts, nothing strange there.  Finally you can’t have a banana split without the…";

            Alien alien3 = new Alien();

            //alien3.healthPoints = 1000;
            alien3.alienName = "Anna the Banana Split";
            alien3.strenght  = new string[1] {
                "Whip Cream (on it)"
            };
            alien3.weakness = new string[2] {
                "Spoon (her)", "Fork (it)"
            };
            alien3.endMessage = "So you might never look at a banana split the same way again, but at least you didn't slip.  Now might be a good time to call for some back up, but before you could reach it you see something rolling toward you!";

            Alien alien4 = new Alien();

            //alien4.healthPoints = 1000;
            alien4.alienName = "Sooki Sushi";
            alien4.strenght  = new string[1] {
                "Wasabi"
            };
            alien4.weakness = new string[2] {
                "ChopSticks", "Soy Sauce"
            };
            alien4.endMessage = "With the evil sushi slayed, the lights turn back on and the hissing coming from your refrigerator stops.  You are free to snack and code another day. YOU SAVED THE EARTH!";


            var stages = new List <Tuple <Alien, Hero, string[, ], string, string, string> >();

            stages.Add(Tuple.Create(alien1, hero, weapons1, alienDraw1(), alien1.alienName, alien1.endMessage));
            stages.Add(Tuple.Create(alien2, hero, weapons2, alienDraw2(), alien2.alienName, alien2.endMessage));
            stages.Add(Tuple.Create(alien3, hero, weapons3, alienDraw3(), alien3.alienName, alien3.endMessage));
            stages.Add(Tuple.Create(alien4, hero, weapons4, alienDraw4(), alien4.alienName, alien4.endMessage));

            foreach (var stage in stages)
            {
                //Moved to method stageCompleted
                stageCompleted(stage);
            }
        }