Esempio n. 1
0
 protected override void LoadContent()
 {
     base.LoadContent();
     GestionSprites = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;
     GestionnaireDeTextures = Game.Services.GetService(typeof(RessourcesManager<Texture2D>)) as RessourcesManager<Texture2D>;
     ImageDeFond = GestionnaireDeTextures.Find(NomImageFond);
 }
Esempio n. 2
0
    public void RecolterMetal()
    {
        int nbSurvivantEnvoyé = EnvoyerRecolter();

        Inventaire.Instance.qteMetalToAdd += Mathf.RoundToInt(nbSurvivantEnvoyé * RessourcesManager.RatioRecolteBois() * 1);;  //a modifier en fonction de ressource manager
        ResetDropDownOption();
    }
        protected override void LoadContent()
        {

            gestionnaireDeTextures = Game.Services.GetService(typeof(RessourcesManager<Texture2D>)) as RessourcesManager<Texture2D>;
            textureTuile = gestionnaireDeTextures.Find(NomTextureTuile);
            base.LoadContent();
        }
Esempio n. 4
0
        protected override void Initialize()
        {

            Vector3 positionCaméra = new Vector3(-25, 50, -120);
            Vector3 cibleCaméra = new Vector3(0, 0, 0);

            GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
            GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
            GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
            GestionnaireDeShaders = new RessourcesManager<Effect>(this, "Effects");
            GestionInput = new InputManager(this);
            CaméraJeu = new CaméraSubjective(this, positionCaméra, cibleCaméra, Vector3.Up, INTERVALLE_MAJ_STANDARD);

            Components.Add(new Carte(this, 1f, Vector3.Zero, Vector3.Zero, new Vector3(DIMENSION_TERRAIN, 50, DIMENSION_TERRAIN), "Terrain", "DétailsTerrain", 5, INTERVALLE_MAJ_STANDARD));
            Components.Add(GestionInput);
            Components.Add(CaméraJeu);
            Components.Add(new Afficheur3D(this));
            
            Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
            Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
            Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
            Services.AddService(typeof(RessourcesManager<Effect>), GestionnaireDeShaders);
            Services.AddService(typeof(InputManager), GestionInput);
            Services.AddService(typeof(Caméra), CaméraJeu);
            GestionSprites = new SpriteBatch(GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), GestionSprites);
            base.Initialize();
        }
      protected override void Initialize()
      {
         const int DIMENSION_TERRAIN = 256;
         Vector2 étenduePlan = new Vector2(DIMENSION_TERRAIN, DIMENSION_TERRAIN);
         Vector2 charpentePlan = new Vector2(4, 3);
         Vector3 positionCaméra = new Vector3(0, 20, 125);
         Vector3 cibleCaméra = new Vector3(0, 0, 0);
         Vector3 positionARC170 = new Vector3(25, 15, 0);
         Vector3 positionBiplan = new Vector3(20, 10, 0);
         Vector3 positionFeisar = new Vector3(20, 15, 20);
         Vector3 positionCylindre1 = new Vector3(-90, 10, -90);
         Vector3 positionCylindre2 = new Vector3(-20, 10, -20);
         Vector3 positionCylindre3 = new Vector3(-90, 10, 90);
         ListeMurs = new List<GameComponent>();

         GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
         GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
         GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
         GestionnaireDeShaders = new RessourcesManager<Effect>(this, "Effects");
         GestionnaireDeSoundEffect = new RessourcesManager<SoundEffect>(this, "Sounds");
         GestionnaireDeSong = new RessourcesManager<Song>(this, "Songs");
         GestionInput = new InputManager(this);
         GestionSounds = new SoundManager(this);
         CaméraJeu = new Caméra(this, new Vector3(-105f, 0f, 4f), new Vector3(0f,(float)Math.PI/2f,0f), 50f, "jump", "landing","walk", "backgroundMusic", "walk_slow");

         Components.Add(GestionSounds);
         Components.Add(GestionInput);
         Components.Add(CaméraJeu);

         Components.Add(new Afficheur3D(this));

         Components.Add(new Carte(this, new Vector3(DIMENSION_TERRAIN, 25, DIMENSION_TERRAIN), "Terrain"));

         //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, MathHelper.PiOver2, 0), new Vector3(-DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielGauche", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.PiOver2, 0), new Vector3(DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielDroite", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, Vector3.Zero, new Vector3(0, DIMENSION_TERRAIN / 2, -DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielAvant", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.Pi, 0), new Vector3(0, DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielArrière", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new PlanTexturé(this, 1f, new Vector3(MathHelper.PiOver2, 0, 0), new Vector3(0, DIMENSION_TERRAIN - 1, 0), étenduePlan, charpentePlan, "CielDessus", INTERVALLE_MAJ_STANDARD));
         
         Components.Add(new Cylindre(this, 1f, new Vector3(0, MathHelper.PiOver2, 0), positionCylindre1, new Vector2(5f, 10f), new Vector2(30, 30), "old_brick_01", INTERVALLE_MAJ_STANDARD));
         
         Services.AddService(typeof(Random), new Random());
         Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
         Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
         Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
         Services.AddService(typeof(RessourcesManager<Effect>), GestionnaireDeShaders);
         Services.AddService(typeof(RessourcesManager<SoundEffect>), GestionnaireDeSoundEffect);
         Services.AddService(typeof(RessourcesManager<Song>), GestionnaireDeSong);
         Services.AddService(typeof(InputManager), GestionInput);
         Services.AddService(typeof(SoundManager), GestionSounds);
         Services.AddService(typeof(Caméra), CaméraJeu);
         GestionSprites = new SpriteBatch(GraphicsDevice);
         Services.AddService(typeof(SpriteBatch), GestionSprites);

         base.Initialize();
         GestionSounds.Play("backgroundMusic");
         //GestionSounds.Play("First_Sentence", false, 0.5f);

      }
 protected override void LoadContent()
 {
     EffetDeBase = new BasicEffect(GraphicsDevice);
     gestionnaireDeTextures = Game.Services.GetService(typeof(RessourcesManager<Texture2D>)) as RessourcesManager<Texture2D>;
     image = gestionnaireDeTextures.Find(NomTexture);
     InitialiserParamètresEffetDeBase();
     base.LoadContent();
 }
Esempio n. 7
0
 protected override void LoadContent()
 {
     GestionSprites = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;
     GestionnaireDeTextures = Game.Services.GetService(typeof(RessourcesManager<Texture2D>)) as RessourcesManager<Texture2D>;
     Image = GestionnaireDeTextures.Find(NomImage);
     Origine = new Vector2((Image.Width / 2) - 30, Image.Height * 2);
     //Position = new Vector2(Position.X - Orig, Position.Y - (Image.Height/2));
 }
Esempio n. 8
0
 public override bool collect()
 {
     PopupFloatingText.instance.ShowMessage("+" + ressource.value, transform, RessourcesManager.getRessourceColor(ressource.name));
     //GameManager.playerInstance.GetComponent<Player>().getRessources ()[ressource.name]+=ressource.value;
     GameManager.playerInstance.GetComponent <Player>().gainRessource(ressource.name, ressource.value);
     MapManager.instance.resetPosition(gameObject.transform.position);
     return(true);
     //Destroy(gameObject);
 }
    void Start()
    {
        shaderProperty   = Shader.PropertyToID("_cutoff");
        _renderer        = GetComponent <Renderer>();
        ps               = GetComponentInChildren <ParticleSystem>();
        playerRessources = GameObject.FindGameObjectWithTag("Player").GetComponent <RessourcesManager>();
        var main = ps.main;

        main.duration = spawnEffectTime;

        ps.Play();
    }
Esempio n. 10
0
        public GestionnaireDeScènes(RPG jeu, SpriteBatch spritesMgr, RessourcesManager<SpriteFont> fontsMgr,
                                      RessourcesManager<Texture2D> texturesMgr, RessourcesManager<Model> modelsMgr, InputManager inputMgr)
            : base(jeu)
        {
            Jeu = jeu;
            SpritesManager = spritesMgr;
            FontsManager = fontsMgr;
            TexturesManager = texturesMgr;
            ModelsManager = modelsMgr;
            InputManager = inputMgr;

            ListeDesScènes = new List<Scène>();
        }
Esempio n. 11
0
      protected override void Initialize()
      {
         Vector2 DimensionÉcran = new Vector2(GameConstants.WindowWidth, GameConstants.WindowHeight);
         AfficheurFPS_ a = new AfficheurFPS_(this, 1 / 60f);
         F1 = new Fusil(this, "balle", Vector2.Zero, new Vector2(15, 15), new Vector2(0, -15));
         cam = new Camera2d();
         cam.Pos = Vector2.Zero;

         GestionnaireTextures = new RessourcesManager<Texture2D>(this, "Textures");
         GestionnaireFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
         GestionnaireInput = new InputManager(this);
         spriteBatch = new SpriteBatch(GraphicsDevice);

         Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireTextures);
         Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireFonts);
         Services.AddService(typeof(InputManager), GestionnaireInput);
         Services.AddService(typeof(SpriteBatch), spriteBatch);
         Services.AddService(typeof(Camera2d), cam);

         ListeComposantes = new List<IColisionable>();

         ioManagerJ1 = new IOManager(this, 1);
         J1 = new Avatar(this, "hitman1_stand", DimensionÉcran / 2, new Vector2(30, 30), 1f / 1000, 1, ioManagerJ1);
         InfoJ1 = new InformationJoueur(this, "tile_12", new Vector2(100, 50), new Vector2(200, 100), J1);
         

         
         Components.Add(GestionnaireInput);
         Components.Add(a);
         //Components.Add(J1);
         Components.Add(ioManagerJ1);

         //-------------------------------- Test physique------------------//
         ListePhysique = new List<EntitéPhysique>();
         T1 = new Tile(this, "CielÉtoilé", new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 0), new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 0), 1 / 60f, 0.2f);
         T2 = new Tile(this, "tile_12", new Vector3(0, DimensionÉcran.Y / 2, 1f), new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 0), 1 / 60f,0.9f);
         J1Test = new Avatar_(this, "balle", new Vector3(DimensionÉcran.X / 2, DimensionÉcran.Y / 2, 5f), new Vector3(30, 30, 1), 1 / 60f, 1, ioManagerJ1);
         Components.Add(J1Test);
         Components.Add(T1);
         Components.Add(T2);
         ListePhysique.Add(J1Test);
         ListePhysique.Add(T1);
         ListePhysique.Add(T2);
         //----------------------------------------------------------------//

         base.Initialize();

         F1.Initialize(); //les classes que je ne veux pas mettre en components pour que ne soient pas automatiquement updater/dessiner
         InfoJ1.Initialize();
      }
    void Awake()
    {
        if (Instance != null)
        {
            DestroyImmediate(Instance);
        }
        else
        {
            Instance = this;
        }

        ressources.Add(RessourceType.fer, new HashSet <Ressource>());
        ressources.Add(RessourceType.mer, new HashSet <Ressource>());
        ressources.Add(RessourceType.rubith, new HashSet <Ressource>());
    }
Esempio n. 13
0
    public override void damage(int loss)
    {
        int previousHp = hp;

        hp -= loss;
        PopupFloatingText.instance.ShowMessage("+" + loss, transform, RessourcesManager.getRessourceColor(type));
        //GameManager.playerInstance.GetComponent<Player>().getRessources ()[type]+=previousHp-hp;
        GameManager.playerInstance.GetComponent <Player>().gainRessource(type, previousHp - hp);

        Vector3 particlesPos = new Vector3(transform.position.x, transform.position.y, transform.position.z - 1);

        Instantiate(damageParticles, particlesPos, Quaternion.identity);
        if (hp <= 0)
        {
            MapManager.instance.resetPosition(gameObject.transform.position);
            //Destroy(gameObject);
        }
    }
Esempio n. 14
0
        protected override void LoadContent()
        {
            float demiMarge = Marge / 2f;

            GestionSprites = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;
            GestionFont = Game.Services.GetService(typeof(RessourcesManager<SpriteFont>)) as RessourcesManager<SpriteFont>;
            Font = GestionFont.Find(NomFont);

            Vector2 dimension = Font.MeasureString(TexteÀAfficher);

            ZoneAffichageMarge = new Rectangle((int)(ZoneAffichage.X + (demiMarge * ZoneAffichage.Width)), (int)(ZoneAffichage.Y + (demiMarge * ZoneAffichage.Height)), 
                                        (int)(ZoneAffichage.Width - (Marge * ZoneAffichage.Width)), (int)(ZoneAffichage.Height - (Marge * ZoneAffichage.Height)));
            Échelle = MathHelper.Min(ZoneAffichageMarge.Width / dimension.X, ZoneAffichageMarge.Height / dimension.Y);
            Position = new Vector2(ZoneAffichageMarge.X + (ZoneAffichageMarge.Width / 2f), ZoneAffichageMarge.Y + (ZoneAffichageMarge.Height/2));
            Origine = new Vector2(dimension.X / 2,dimension.Y / 2);


            base.LoadContent();
        }
    void Awake()
    {
        intance        = this;
        firstSmallIdle = SmallIdleSpeed;
        firstBigIdle   = BigIdleSpeed;
        SmallIdleSpeed = BigIdleSpeed = 0;

        distance       = PlayerPrefs.GetFloat("distance", distance);
        ClicPower      = PlayerPrefs.GetFloat("clicPower", initialClicPower);
        ClicPrice      = PlayerPrefs.GetFloat("clicPrice", initialClicPrice);
        MaxCombo       = PlayerPrefs.GetFloat("maxCombo", initialMaxCombo);
        ComboPrice     = PlayerPrefs.GetFloat("comboPrice", initialComboPrice);
        SmallIdleSpeed = PlayerPrefs.GetFloat("smallIdleSpeed", initialSmallIdleSpeed);
        SmallIdlePrice = PlayerPrefs.GetFloat("smallIdlePrice", initialSmallIdlePrice);
        BigIdleSpeed   = PlayerPrefs.GetFloat("bigIdleSpeed", initialBigIdleSpeed);
        BigIdlePrice   = PlayerPrefs.GetFloat("bigIdlePrice", initialBigIdlePrice);

        StartCoroutine(Save());
    }
Esempio n. 16
0
    void Awake()
    {
        buildingToPlace = null;
        placingObject   = false;
        audioSource     = gameObject.GetComponent <AudioSource>();
        mapManager      = MapManager.instance;

        ressources             = RessourcesManager.getRessourcesDictionnary();
        ressources ["gold"]    = PlayerPrefs.GetInt("goldAmount");
        ressources ["copper"]  = PlayerPrefs.GetInt("copperAmount");
        ressources ["iron"]    = PlayerPrefs.GetInt("ironAmount");
        ressources ["coal"]    = PlayerPrefs.GetInt("coalAmount");
        ressources ["uranium"] = PlayerPrefs.GetInt("uraniumAmount");
        digDamages             = RessourcesManager.getRessourcesDictionnary(1);

        playerCamera   = transform.Find("Camera").GetComponent <Camera>();
        selectionTiles = transform.Find("SelectionTiles");
        sprite         = transform.Find("Sprite");
    }
Esempio n. 17
0
    void OnValidate()      //check if the costs corresponds to the existings ressources
    {
        RessourcesManager.SerializedRessource[] ressources = RessourcesManager.getRessourceList();
        if (costs.Length != ressources.Length)
        {
            costs = RessourcesManager.getRessourceList();
        }
        bool namesChanged = false;

        for (int i = 0; i < ressources.Length; i++)
        {
            if (costs[i].name != ressources[i].name)
            {
                namesChanged = true;
            }
        }
        if (namesChanged)
        {
            costs = RessourcesManager.getRessourceList();
        }
    }
Esempio n. 18
0
    public void InitTier()
    {
        // Set CamSeason
        transform.parent.GetComponent <CamSeason>().CurrentSeason = "Spring";

        // Fetch Overdrive Display script
        OverDriveDisplay = GameObject.FindGameObjectWithTag("Resource Canvas").transform.Find("Ressources Panel").GetComponent <OverdriveDisplay>();

        // Fetch resources scripts and start year
        ResourceDisplay  = OverDriveDisplay.GetComponent <ResourceDisplay>();
        ResourcesManager = GetComponent <RessourcesManager>();
        ResourcesManager.StartYear();

        // Get main camera
        Camera = Camera.main;

        // Set resource decay
        /*_corDecay = */
        StartCoroutine(CorDecayResources());

        // Set button behaviour
        button.onClick.AddListener(ActionTier);
    }
Esempio n. 19
0
        protected override void Initialize()
        {
            //const int DIMENSION_TERRAIN = 256;
            //Vector2 étenduePlan = new Vector2(DIMENSION_TERRAIN, DIMENSION_TERRAIN);
            //Vector2 charpentePlan = new Vector2(4, 3);
            //Vector3 positionCaméra = new Vector3(0, 250, 125);
            //Vector3 cibleCaméra = new Vector3(0, 0, 0);

            GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
            GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
            //GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
            GestionnaireDeShaders = new RessourcesManager<Effect>(this, "Effects");
            GestionInput = new InputManager(this);
            //CaméraJeu = new CaméraSubjective(this, positionCaméra, cibleCaméra, Vector3.Up, INTERVALLE_MAJ_STANDARD);

            Components.Add(new Menu(this));
            Components.Add(GestionInput);
            //Components.Add(CaméraJeu);
            //Components.Add(new Afficheur3D(this));
            //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, MathHelper.PiOver2, 0), new Vector3(-DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "BeerPong", INTERVALLE_MAJ_STANDARD));
            //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.PiOver2, 0), new Vector3(DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "BeerPong", INTERVALLE_MAJ_STANDARD));
            //Components.Add(new PlanTexturé(this, 1f, Vector3.Zero, new Vector3(0, DIMENSION_TERRAIN / 2, -DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "BeerPong", INTERVALLE_MAJ_STANDARD));
            //Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.Pi, 0), new Vector3(0, DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "BeerPong", INTERVALLE_MAJ_STANDARD));
            //Components.Add(new PlanTexturé(this, 1f, new Vector3(MathHelper.PiOver2, 0, 0), new Vector3(0, DIMENSION_TERRAIN - 1, 0), étenduePlan, charpentePlan, "BeerPong", INTERVALLE_MAJ_STANDARD));
            //Components.Add(new AfficheurFPS(this, "Arial20", Color.Gold, INTERVALLE_CALCUL_FPS));

            Services.AddService(typeof(Random), new Random());
            Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
            Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
            //Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
            Services.AddService(typeof(RessourcesManager<Effect>), GestionnaireDeShaders);
            Services.AddService(typeof(InputManager), GestionInput);
            //Services.AddService(typeof(Caméra), CaméraJeu);
            GestionSprites = new SpriteBatch(GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), GestionSprites);
            base.Initialize();
        }
Esempio n. 20
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()
        {
            s = new Shutter(this, "Shutter", INTERVALLE_CALCUL_STANDARD);

             NbJoueurs = 2;
             ListeAvatar = new List<Avatar>();
             terrain = new Map(this, new Vector3(10,0,10), Vector3.Zero);
             ListeManagerControle = new List<IOManager>();
             ListeCaméraAvatars = new List<Caméra>();
             ModelManager ManagerDeModele = new ModelManager(this);
             GestionnaireGameState = new GamestateManager(this);
             ManagerÉcranDEBUG = new ScreenManager(this, Vector2.Zero);
             ViewPortDefaut = GraphicsDevice.Viewport;
             CaméraJeu = new CaméraFixe(this, new Vector3(10, 10, 10), Vector3.Zero, Vector3.Up);
             GénérerViewports(NbJoueurs);

             for (int i = 0; i < NbJoueurs; ++i)
             {
            ListeManagerControle.Add(new IOManager(this, ListePlayerIndex[i],INTERVALLE_CALCUL_STANDARD));
             }
             for (int i = 0; i < NbJoueurs; ++i)
             {
             ListeAvatar.Add(new Avatar(this, Content.Load<DescriptionAvatar>("Descriptions/Avatar" + i), ListePlayerIndex[i], ListeManagerControle[i]));
             }
             for (int i = 0; i < NbJoueurs; ++i)
             {
            ListeCaméraAvatars.Add(new CaméraAvatar(this, ListeAvatar[i].Position, Vector3.Up, ListeAvatar[i] as Avatar, ListeViewports[i]));
             }

             CubeColoré CubeBlanc = new Sol(this, 1f, new Vector3(0, 0, 0.2f), Vector3.Zero, Color.White, new Vector3(50, 2, 10), 1 / 60f);
             CubeColoré CubeRouge = new Sol(this, 1f, new Vector3(0, 0, 0f), new Vector3(0, 3, -5), Color.Red, new Vector3(20, 2f, 10), 1 / 60f);
             CubeColoré CubeBleu = new Sol(this, 1f, new Vector3(0, 0, 0f), new Vector3(0, 1f, 10), Color.Blue, new Vector3(20, 2f, 10), 1 / 60f);
             CubeColoré CubeSol = new Sol(this, 1f, new Vector3(0f, 0, 0f), new Vector3(0, -1, 0), Color.Yellow, new Vector3(200, 2, 200), INTERVALLE_CALCUL_STANDARD);
             //CubeColoré testCollision = new Sol(this, 1, Vector3.Zero, new Vector3(0, -1, 0), Color.Aqua, new Vector3(4, 2, 4), INTERVALLE_CALCUL_STANDARD);

             terrain.Initialize();

             GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
             GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
             GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
             spriteBatch = new SpriteBatch(GraphicsDevice);
             GestionInput = new InputManager(this);

             //Components.Add(new AfficheurFPS(this, "Arial20", Color.Chartreuse, INTERVALLE_CALCUL_FPS));
             Components.Add(new Afficheur3D(this));
             Components.Add(GestionInput);
             Components.Add(CaméraJeu);
             Components.Add(ManagerDeModele);
             Components.Add(GestionnaireGameState);
             Components.Add(terrain);
             Components.Add(s);

             foreach (IOManager i in ListeManagerControle)
            Components.Add(i);
             foreach (Caméra c in ListeCaméraAvatars)
            Components.Add(c);

             ManagerDeModele.AjouterAvatars(ListeAvatar);
             ManagerDeModele.AjouterCaméra(ListeCaméraAvatars);
             ManagerDeModele.AjouterModele(CubeBlanc);
             ManagerDeModele.AjouterModele(CubeBleu);
             ManagerDeModele.AjouterModele(CubeRouge);
             //ManagerDeModele.AjouterModele(testCollision);
             ManagerDeModele.AjouterModele(CubeSol);

             Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
             Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
             Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
             Services.AddService(typeof(InputManager), GestionInput);
             Services.AddService(typeof(Caméra), CaméraJeu);
             Services.AddService(typeof(SpriteBatch), spriteBatch);

             ListePhysique = new List<ICollisionable>();
             foreach (Avatar a in ListeAvatar)
             ListePhysique.Add(a as ICollisionable);

             ListePhysique.Add(CubeBlanc as ICollisionable);
             ListePhysique.Add(CubeRouge as ICollisionable);
             ListePhysique.Add(CubeBleu as ICollisionable);
             ListePhysique.Add(CubeSol as ICollisionable);
             //ListePhysique.Add(testCollision as ICollisionable);

             Grille = new Grid(new Vector3(50, -8f, 50), 0.5f, this);
             //for (int i = 0; i < 1; i++)
             //{
             //    Ennemi ennemi = new Ennemi(this, "unicorn", new Vector3(i, 2, i), new Vector3(1, 2, 1), INTERVALLE_CALCUL_STANDARD, 0.5f, GameConstants.ViePersonnageMax, ListeAvatar, grille, i, new Vector3[8]);//, path);
             //    ManagerDeModele.AjouterModele(ennemi);
             //    ListePhysique.Add(ennemi as ICollisionable);
             //    if (i == 0)
             //    {
             //        Ennemi = ennemi;
             //    }
             //}
             Bazooka Bazooka = new Bazooka(this, "Bazooka", new Vector3(0, 2, 0), Vector3.One, 0.05f);
             SupportFusil SupportFusil = new SupportFusil(this, "SupportFusil", new Vector3(0, 10, 0), Vector3.One, 0.05f, Bazooka);
             ManagerDeModele.AjouterModele(Bazooka);
             ManagerDeModele.AjouterModele(SupportFusil);
             ListePhysique.Add(Bazooka as ICollisionable);
             ListePhysique.Add(SupportFusil as ICollisionable);

             foreach (Sol objet in terrain.ListeObjets)
             {
             ManagerDeModele.AjouterModele(objet as IModele3d);
             ListePhysique.Add(objet as ICollisionable);
             }

              base.Initialize();

             ManagerÉcranDEBUG.Initialize();
             foreach (Avatar a in ListeAvatar)
            ManagerÉcranDEBUG.AjouterItem(a);

             CubeBlanc.InitialiserSommets(Color.White);
             CubeBleu.InitialiserSommets(Color.Blue);
             CubeRouge.InitialiserSommets(Color.Red);
             //testCollision.InitialiserSommets(Color.Red);
        }
Esempio n. 21
0
        protected override void Initialize()
        {
            Vector3 positionCaméra = new Vector3(0, 10, 0);
            Vector3 cibleCaméra = new Vector3(0, 9, -10);

            GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
            GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
            GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
            GénérateurAléatoire = new Random();
            GestionInput = new InputManager(this);
            GestionSprites = new SpriteBatch(GraphicsDevice);

            //Map = new Terrain(this, Vector3.Zero, new Vector2(300, 300), GestionnaireDeTextures.Find("Sand"), GestionnaireDeTextures.Find("heightmap"));
            //BaldorLeBrave = new Héros(this, "unicorn", 10f, new Vector3(1, 0, -5), new Vector3(0, 0, 0), 0.01f, "Charlie The Hurrnicorn", 30f, MathHelper.Pi * 4, false, 42, 15, 5, 8, 6, 0.8f);
            //faggit = new Monstre(this, BaldorLeBrave, "unicorn", 8f, new Vector3(2, 0, -9), new Vector3(0, 0, 0), 0.01f, "faggit", 25f, MathHelper.Pi * 4, false, 21, 3, 6, 4, 1f, 15, 50);
            //InterfaceUtilisateur = new UI(this, BaldorLeBrave, GestionnaireDeTextures.Find("UI"), GestionnaireDeTextures.Find("Vie"), GestionnaireDeTextures.Find("Mana"));
            //CaméraJeu = new CaméraThirdPerson(this, GestionInput, positionCaméra, BaldorLeBrave, Vector3.Up, 0.01f);

            // Services
            Services.AddService(typeof(InputManager), GestionInput);
            Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
            Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
            Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
            Services.AddService(typeof(SpriteBatch), GestionSprites);
            Services.AddService(typeof(Random), GénérateurAléatoire);

            Components.Add(GestionInput);

            GestionScènes = new GestionnaireDeScènes(this, GestionSprites, GestionnaireDeFonts, GestionnaireDeTextures, GestionnaireDeModèles, GestionInput);
            Components.Add(GestionScènes);

            base.Initialize();
        }
Esempio n. 22
0
        protected override void Initialize()
        {
            //camérajeu = new CaméraSubjective(this, new Vector3(0, 100, 150), new Vector3(0, 80, 0), Vector3.Up, INTERVALLE_MAJ_STANDARD);
              //Components.Add(camérajeu);
              //Services.AddService(typeof(Caméra), camérajeu);

             GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
             GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
             GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
             GestionnaireDeShaders = new RessourcesManager<Effect>(this, "Effects");
             GestionInput = new InputManager(this);

             Components.Add(new Menu(this));

             Components.Add(GestionInput);
             Components.Add(new Afficheur3D(this));
             Components.Add(new AfficheurFPS(this, INTERVALLE_CALCUL_FPS));

             Services.AddService(typeof(Random), new Random());
             Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
             Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
             Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
             Services.AddService(typeof(RessourcesManager<Effect>), GestionnaireDeShaders);
             Services.AddService(typeof(InputManager), GestionInput);
             GestionSprites = new SpriteBatch(GraphicsDevice);
             Services.AddService(typeof(SpriteBatch), GestionSprites);
             base.Initialize();
        }
Esempio n. 23
0
      protected override void Initialize()
      {
         const int DIMENSION_TERRAIN = 256;
         Vector2 étenduePlan = new Vector2(DIMENSION_TERRAIN, DIMENSION_TERRAIN);
         Vector2 charpentePlan = new Vector2(4, 3);
         Vector3 positionCaméra = new Vector3(-8, 11, 120);
         Vector3 cibleCaméra = new Vector3(0, 0, 0);
         Vector3 positionARC170 = new Vector3(25, 15, 0);
         Vector3 positionBiplan = new Vector3(20, 10, 0);
         Vector3 positionFeisar = new Vector3(20, 15, 20);
         Vector3 positionCylindre1 = new Vector3(-90, 10, -90);
         Vector3 positionCylindre2 = new Vector3(-20, 10, -20);
         Vector3 positionCylindre3 = new Vector3(-90, 10, 90);

         GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
         GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
         GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
         GestionnaireDeShaders = new RessourcesManager<Effect>(this, "Effects"); 
         GestionInput = new InputManager(this);
         CaméraJeu = new CaméraSubjective(this, positionCaméra, cibleCaméra, Vector3.Up, INTERVALLE_MAJ_STANDARD);

         Components.Add(GestionInput);
         Components.Add(CaméraJeu);
         Components.Add(new Afficheur3D(this));


          //LignePArking
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-6,1,15), new Vector2(1,98), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-30, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-26, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-22, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-18, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-18, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-30, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-26, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-22, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-48, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-44, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-40, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-40, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-48, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-44, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(20, 1, 25), new Vector2(1, 56), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(35, 1, 25), new Vector2(1, 56), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 25), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 29), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 33), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 37), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 41), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 45), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 49), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 53), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));


         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 25), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 29), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 33), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 37), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 41), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 45), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 49), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 53), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 30), new Vector2(69, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 48), new Vector2(69, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));


          //PAVILLON ORDINIQUE

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50,0,21), new Vector2(20, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 55), new Vector2(20, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(50, 0, 21), new Vector2(68, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(60, 0, 21), new Vector2(68, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturée(this, 1f, Vector3.Zero, new Vector3(50, 5, 21), new Vector2(20, 68), "ToitPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 0.7f, 25), new Vector2(3,4), "PortePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f),3, 24.8f), new Vector2(4,2 ), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 3, 30.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 3, 36.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 3, 42.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 3, 48.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 1.5f, 30.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 1.5f, 36.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 1.5f, 42.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f), 0.7f, 49.1f), new Vector2(3, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));
         
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 0.7f, 25), new Vector2(3, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 3, 24.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 3, 30.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 3, 36.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 3, 42.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 3, 48.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 1.5f, 30.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 1.5f, 36.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 1.5f, 42.8f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f), 0.7f, 49.1f), new Vector2(3, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));



          //PAVILLON ORDINIQUE INTÉRIEUR -MUR-PLAFOND-PLANCHER

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 54.9f), new Vector2(20, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 21.1f), new Vector2(20, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(59.9f, 0, 21), new Vector2(68, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(50.1f, 0, 21), new Vector2(68, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturée(this, 1f, Vector3.Zero, new Vector3(50,0.7f, 21.1f), new Vector2(20, 68), "PlancherIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturée(this, 1f, Vector3.Zero, new Vector3(50, 2.85f, 21.1f), new Vector2(20, 68), "PlancherIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéePlafond(this, 1f, Vector3.Zero, new Vector3(50, 2.71f, 21.1f), new Vector2(20, 68), "PlafondPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéePlafond(this, 1f, Vector3.Zero, new Vector3(50, 4.9f, 21.1f), new Vector2(20, 68), "PlafondPavillon", INTERVALLE_MAJ_STANDARD));


          //Mur cLASSE Pavillon Ordinique 

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 42f), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 41.8f), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 33.7f), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 33.5f), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0,48), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 47.8f), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 27f), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 26.8f), new Vector2(4, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

          //CIEL
         Components.Add(new Terrain(this, 1f, Vector3.Zero, Vector3.Zero, new Vector3(DIMENSION_TERRAIN , 3, DIMENSION_TERRAIN), "LionelEssai4", "TextureEssai2", 3, INTERVALLE_MAJ_STANDARD));
         ////Components.Add(new Terrain(this, 1f, Vector3.Zero, Vector3.Zero, new Vector3(DIMENSION_TERRAIN/5, 10, DIMENSION_TERRAIN/5), "LionelEssai3", "Texture1Essai", 2, INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(0, MathHelper.PiOver2, 0), new Vector3(-DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielGauche", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.PiOver2, 0), new Vector3(DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielDroite", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, Vector3.Zero, new Vector3(0, DIMENSION_TERRAIN / 2, -DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielAvant", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.Pi, 0), new Vector3(0, DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielArrière", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(MathHelper.PiOver2, 0, 0), new Vector3(0, DIMENSION_TERRAIN - 1, 0), étenduePlan, charpentePlan, "CielDessus", INTERVALLE_MAJ_STANDARD));

         ////Components.Add(new ObjetDePatrouille(this, "ARC170", 0.002f, new Vector3(0, MathHelper.Pi, -MathHelper.PiOver2), positionARC170, positionCylindre1, 36, 6f, INTERVALLE_MAJ_STANDARD));
         //Components.Add(new ObjetDePatrouille(this, "Feisar", 0.01f, Vector3.Zero, positionFeisar, positionCylindre2, 24, 8, INTERVALLE_MAJ_STANDARD));
         //Components.Add(new ObjetDePatrouille(this, "Airplane_blue", 1f, new Vector3(0, 0, MathHelper.PiOver4), positionBiplan, positionCylindre3, 36, 7, INTERVALLE_MAJ_STANDARD));

         //Components.Add(new Cylindre(this, 1f, Vector3.Zero, positionCylindre1, new Vector2(10f, 20f), new Vector2(30, 30), "SQWAD", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new Cylindre(this, 1f, new Vector3(0, 0, 0), positionCylindre2, new Vector2(10f, 20f), new Vector2(30, 30), "SQWAD", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new Cylindre(this, 1f, Vector3.Zero, positionCylindre3, new Vector2(10f, 20f), new Vector2(30, 30), "SQWAD", INTERVALLE_MAJ_STANDARD));
         Components.Add(new AfficheurFPS(this, "Arial20", Color.Gold, INTERVALLE_CALCUL_FPS));

         Services.AddService(typeof(Random), new Random());
         Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
         Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
         Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
         Services.AddService(typeof(RessourcesManager<Effect>), GestionnaireDeShaders);
         Services.AddService(typeof(InputManager), GestionInput);
         Services.AddService(typeof(Caméra), CaméraJeu);
         GestionSprites = new SpriteBatch(GraphicsDevice);
         Services.AddService(typeof(SpriteBatch), GestionSprites);
         base.Initialize();
      }
 public override void InitializeTrait(GameObject initGameObject)
 {
     gameObject        = initGameObject;
     ressourcesManager = gameObject.GetComponent <RessourcesManager>();
     ressourcesManager.AddBonusAmmo(bonusAmmo);
 }
Esempio n. 25
0
      protected override void Initialize()
      {
         const int DIMENSION_TERRAIN = 512;
         Vector2 étenduePlan = new Vector2(DIMENSION_TERRAIN, DIMENSION_TERRAIN);
         Vector2 charpentePlan = new Vector2(4, 3);

         Vector3 positionCaméra = new Vector3(5, 5, 5);

       

         Vector3 cibleCaméra = new Vector3(0, 0, 0);

         GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
         GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
         GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
         GestionnaireDeShaders = new RessourcesManager<Effect>(this, "Effects");
         GestionnaireSound = new RessourcesManager<SoundEffect>(this,"Sounds");
         GestionInput = new InputManager(this);
         CaméraJeu = new CaméraFirstPerson(this, positionCaméra, cibleCaméra, Vector3.Up, INTERVALLE_MAJ_STANDARD, "LionelEssai4");


         liste  = new List<SoundEffect>();

         for (int z = 1; z <= 2; ++z)
         {
             liste.Add(GestionnaireSound.Find("beat" + z.ToString()));
         }
        
          

         Services.AddService(typeof(RessourcesManager<SoundEffect>), new RessourcesManager<SoundEffect>(this, "Sounds"));


         Components.Add(GestionInput);
         Components.Add(CaméraJeu);
         Components.Add(new Afficheur3D(this));
    #endregion

         #region LIGNE PARKING


         //LignePArking
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-6,1,15), new Vector2(1,98), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-30, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-26, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-22, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-18, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-18, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-30, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-26, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-22, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-48, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-44, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-40, 1, 25), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-40, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-48, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-44, 1, 43), new Vector2(1, 20), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(20, 1, 25), new Vector2(1, 56), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(35, 1, 25), new Vector2(1, 56), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 25), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 29), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 33), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 37), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 41), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 45), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 49), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(30, 1, 53), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));


         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 25), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 29), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 33), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 37), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 41), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 45), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 49), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(15, 1, 53), new Vector2(20, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 30), new Vector2(69, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileColorée(this, 1f, Vector3.Zero, new Vector3(-52, 1, 48), new Vector2(69, 1), Color.Gold, INTERVALLE_MAJ_STANDARD));
         #endregion

         #region PAVILLON ORDINIQUE
         //PAVILLON ORDINIQUE

         //StreamReader fichierLecture = new StreamReader(@"../../" + nomFichier, System.Text.Encoding.UTF7);
         //char[] séparateur = new char[] { ';' };
         //char[] SéparateurNom = new char[] { ',' };
         //List<String> lignes = new List<string>();
         //string lignelu;

         //while(!fichierLecture.EndOfStream)
         //{
         //    lignelu = fichierLecture.ReadLine();
         //    string[] champs = lignelu.Split(séparateur[0]);
         //    lignes.Add(champs[0]);
         //    lignes.Add(champs[1]);
         //}

         //for (int i = 0; i < NOMBRE_DE_LIGNE; ++i)
         //{

         //}


         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(100, 0, 21*2), new Vector2(20, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(100, 0, 55*2), new Vector2(20, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(100, 0, 21*2), new Vector2(68, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(120, 0, 21*2), new Vector2(68, 10), "MurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturée(this, 1f, Vector3.Zero, new Vector3(100, 5, 21*2), new Vector2(20, 68), "ToitPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(49.99f*2, 0.7f*2, 25), new Vector2(3,4), "PortePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f*2),3*2, 24.8f*2), new Vector2(4,2 ), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 3 , 30.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 3 , 36.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 3 , 42.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 3 , 48.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 1.5f * 2, 30.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 1.5f , 36.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 1.5f, 42.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((49.99f * 2), 0.7f , 49.1f * 2), new Vector2(3, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 0.7f, 25 * 2), new Vector2(3, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 3, 24.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 3, 30.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 3, 36.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 3, 42.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 3, 48.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 1.5f, 30.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 1.5f, 36.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 1.5f, 42.8f * 2), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((50.2f * 2), 0.7f, 49.1f * 2), new Vector2(3, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));

         


         //PAVILLON ORDINIQUE INTÉRIEUR -MUR-PLAFOND-PLANCHER

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50 * 2, 0, 54.9f * 2), new Vector2(20, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0 * 2, 21.1f * 2), new Vector2(20, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(59.9f * 2, 0, 21 * 2), new Vector2(68, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(50.1f * 2, 0, 21 * 2), new Vector2(68, 10), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturée(this, 1f, Vector3.Zero, new Vector3(50 * 2, 0.7f, 21.1f * 2), new Vector2(20, 68), "PlancherIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturée(this, 1f, Vector3.Zero, new Vector3(50 * 2, 2.85f, 21.1f * 2), new Vector2(20, 68), "PlancherIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéePlafond(this, 1f, Vector3.Zero, new Vector3(50 * 2, 2.71f, 21.1f * 2), new Vector2(20, 68), "PlafondPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéePlafond(this, 1f, Vector3.Zero, new Vector3(50 * 2, 4.9f, 21.1f * 2), new Vector2(20, 68), "PlafondPavillon", INTERVALLE_MAJ_STANDARD));

#endregion


         #region Mur cLASSE Pavillon Ordinique


         #region CLASSE PAVILLON ORDINIQUE
         //Mur cLASSE Pavillon Ordinique 
         
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 42f), new Vector2(7, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 41.8f), new Vector2(7, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 33.7f), new Vector2(7, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 33.5f), new Vector2(7, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 48), new Vector2(7, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 47.99f), new Vector2(7, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 2.71f, 48), new Vector2(9, 4.75f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 2.71f, 47.99f), new Vector2(9, 4.75f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50, 0, 27f), new Vector2(7, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(50, 0, 26.99f), new Vector2(7, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(53.5f, 0, 27f), new Vector2(42f, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(53.49f, 0, 27f), new Vector2(41.8f, 9.9f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54.5f, 2.71f, 48f), new Vector2(13.7f, 4.75f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(54.49f, 2.71f, 48f), new Vector2(13.7f, 4.75f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         #endregion


         #region CAFÉ PAVILLON ORDINIQUE
         //Café pavillon Ordinique
         
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(56.5f, 0, 48), new Vector2(7, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(56.5f, 0, 47.99f), new Vector2(7, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(56.5f, 0, 27f), new Vector2(42.1f, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(56.5f, 0, 27f), new Vector2(42.1f, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(56.5f, 0, 27f), new Vector2(7, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(56.5f, 0, 26.99f), new Vector2(7, 5.1f), "MurIntérieurPavillon", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(56.6f, 0.7f, 40f), new Vector2(2.5f, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(56.4f, 0.7f, 40f), new Vector2(2.5f, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));


         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3((56.55f), 1.3f, 40f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3((56.45f), 1.3f, 40f), new Vector2(4, 2), "FenetrePavillon", INTERVALLE_MAJ_STANDARD));
        
         #endregion 

         #region CASIER PAVILLON
         //CasierPavillon

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54f, 2.71f, 32f), new Vector2(6, 3), "casier", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(53.5f, 2.71f, 32f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(53.5f, 2.71f, 35f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new TuileTexturée(this, 1f, Vector3.Zero, new Vector3(53.5f, 4.21f, 34f), new Vector2(1f, 6f), "beige", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54f, 0.7f, 32f), new Vector2(6, 3), "casier", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(53.5f, 0.7f, 32f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(53.5f, 0.7f, 35f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54f, 0.7f, 38f), new Vector2(6, 3), "casier", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(53.5f, 0.7f, 38f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(53.5f, 0.7f, 41f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54f, 2.71f, 38f), new Vector2(6, 3), "casier", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(53.5f, 2.71f, 38f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(53.5f, 2.71f, 41f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54f, 0.7f, 44f), new Vector2(6, 3), "casier", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(53.5f, 0.7f, 44f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(53.5f, 0.7f, 47f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54f, 2.71f, 44f), new Vector2(6, 3), "casier", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(53.5f, 2.71f, 44f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical(this, 1f, Vector3.Zero, new Vector3(53.5f, 2.71f, 47f), new Vector2(1f, 3f), "beige", INTERVALLE_MAJ_STANDARD));

         #endregion

         #region PORTE PAVILLON
         //PortePavillon
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(53.51f, 0.7f, 30f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(53.48f, 0.7f, 30f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(53.51f, 2.71f, 30f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(53.48f, 2.71f, 30f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(53.51f, 0.7f, 36f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(53.48f, 0.7f, 36f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(53.51f, 2.71f, 36f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(53.48f, 2.71f, 36f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(53.51f, 0.7f, 42f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(53.48f, 0.7f, 42f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(53.51f, 2.71f, 42f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(53.50f, 2.71f, 42f), new Vector2(2, 3), "PortePavillonInterieur", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54.51f, 2.71f, 53f), new Vector2(2.5f, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));
         Components.Add(new TuileTexturéeVertical3(this, 1f, Vector3.Zero, new Vector3(54.48f, 2.71f, 53f), new Vector2(2.5f, 4), "PortePavillon", INTERVALLE_MAJ_STANDARD));


        
        
         Components.Add(new TuileTexturéeVertical4(this, 1f, Vector3.Zero, new Vector3(54.515f, 4.3f, 53.5f), new Vector2(0.5f, 0.1f), "P106", INTERVALLE_MAJ_STANDARD));
         #endregion

         #region Tableau Blanc Pavillon 
         //TableauBlanc Pavillon

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50.75f, 1, 41.98f), new Vector2(4, 3), "TableauBlanc", INTERVALLE_MAJ_STANDARD));
        
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50.75f, 1, 33.5f), new Vector2(4, 3), "TableauBlanc", INTERVALLE_MAJ_STANDARD));
         
         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50.75f, 1, 47.8f), new Vector2(4, 3), "TableauBlanc", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50.75f, 3.21f, 41.98f), new Vector2(4, 3), "TableauBlanc", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50.75f, 3.21f, 33.5f), new Vector2(4, 3), "TableauBlanc", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(50.75f, 3.21f, 47.8f), new Vector2(4, 3), "TableauBlanc", INTERVALLE_MAJ_STANDARD));

         Components.Add(new TuileTexturéeVertical2(this, 1f, Vector3.Zero, new Vector3(51.75f, 3.21f, 54.85f), new Vector2(4, 3), "TableauBlanc", INTERVALLE_MAJ_STANDARD));
//Tableau echelard

         Components.Add(new TuileDiagonalTexturé(this, 1f, Vector3.Zero, new Vector3(50.2f, 3.38f, 53.85f), new Vector2(3f, 3), "ToileProjecteur", INTERVALLE_MAJ_STANDARD));


       // Components.Add(new ObjetDeBase(this,"Computer Table",0.0002f,Vector3.Zero,new Vector3(60f, 4f, 60f)));

         // Components.Add(new ObjetDePatrouille(this, "Computer Table", 1f, new Vector3(0, 0, 0), new Vector3(50.2f, 3.38f, 52.85f), new Vector3(50.2f, 3.38f, 52.85f), 0, 0, INTERVALLE_MAJ_STANDARD));
         #endregion

         #region BAHAYE

         //

          //CIEL
         Components.Add(new Terrain(this, 1f, Vector3.Zero, Vector3.Zero, new Vector3(DIMENSION_TERRAIN , 3, DIMENSION_TERRAIN), "LionelEssai4", "TextureEssai2", 3, INTERVALLE_MAJ_STANDARD));
         ////Components.Add(new Terrain(this, 1f, Vector3.Zero, Vector3.Zero, new Vector3(DIMENSION_TERRAIN/5, 10, DIMENSION_TERRAIN/5), "LionelEssai3", "Texture1Essai", 2, INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(0, MathHelper.PiOver2, 0), new Vector3(-DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielGauche", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.PiOver2, 0), new Vector3(DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2, 0), étenduePlan, charpentePlan, "CielDroite", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, Vector3.Zero, new Vector3(0, DIMENSION_TERRAIN / 2, -DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielAvant", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(0, -MathHelper.Pi, 0), new Vector3(0, DIMENSION_TERRAIN / 2, DIMENSION_TERRAIN / 2), étenduePlan, charpentePlan, "CielArrière", INTERVALLE_MAJ_STANDARD));
         Components.Add(new PlanTexturé(this, 1f, new Vector3(MathHelper.PiOver2, 0, 0), new Vector3(0, DIMENSION_TERRAIN - 1, 0), étenduePlan, charpentePlan, "CielDessus", INTERVALLE_MAJ_STANDARD));

         //Components.Add(new ObjetDePatrouille(this, "Computer Table", 0.002f, new Vector3(0, MathHelper.Pi, -MathHelper.PiOver2), positionARC170, positionCylindre1, 36, 6f, INTERVALLE_MAJ_STANDARD));
         //Components.Add(new ObjetDePatrouille(this, "Feisar", 0.01f, Vector3.Zero, positionFeisar, positionCylindre2, 24, 8,));
//Components.Add(new ObjetDePatrouille(this, "Airplane_blue", 1f, new Vector3(0, 0, MathHelper.PiOver4), positionBiplan, positionCylindre3, 36, 7, INTERVALLE_MAJ_STANDARD));

         //Components.Add(new Cylindre(this, 1f, Vector3.Zero, positionCylindre1, new Vector2(10f, 20f), new Vector2(30, 30), "SQWAD", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new Cylindre(this, 1f, new Vector3(0, 0, 0), positionCylindre2, new Vector2(10f, 20f), new Vector2(30, 30), "SQWAD", INTERVALLE_MAJ_STANDARD));
         //Components.Add(new Cylindre(this, 1f, Vector3.Zero, positionCylindre3, new Vector2(10f, 20f), new Vector2(30, 30), "SQWAD", INTERVALLE_MAJ_STANDARD));
         Components.Add(new AfficheurFPS(this, "Arial20", Color.Gold, INTERVALLE_CALCUL_FPS));

         Services.AddService(typeof(Random), new Random());
         Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
         Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
         Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
         Services.AddService(typeof(RessourcesManager<Effect>), GestionnaireDeShaders);
         Services.AddService(typeof(InputManager), GestionInput);
         Services.AddService(typeof(Caméra), CaméraJeu);
         GestionSprites = new SpriteBatch(GraphicsDevice);
         Services.AddService(typeof(SpriteBatch), GestionSprites);
         base.Initialize();
      }
Esempio n. 26
0
    // Update is called once per frame
    void Update()
    {
        //LeftMouseButton takes array of targets(villagers) with rightclick move on position
        //if (Input.GetMouseButtonDown(0))
        if (agent.remainingDistance <= distanceLeft)
        {
            //Debug.Log("Remaining Distance");
            agent.isStopped = true;
        }
        if (isSelected == true)
        {
            if (Input.GetMouseButtonDown(1))
            {
                Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit))
                {
                    resourceManager = hit.collider.gameObject.GetComponent <RessourcesManager>();
                    if (resourceManager != null)
                    {
                        Debug.Log("HOER resssssour" + resourceManager.resourceType);
                    }
                    MoveToPoint(hit.point);

                    isSelected = false;
                    Debug.Log("We hit: " + hit.collider.name + " " + hit.point);
                    //Move target to what we hit
                }
            }
        }
        if (inventory >= maxInventory)
        {
            MoveToPoint(GameObject.Find("TownCenters").transform.GetChild(0).gameObject.GetComponent <TownCenterController>().storagePlace.transform.position);
            inventoryIsFull = true;
        }
        else
        {
            inventoryIsFull = false;
        }
        if (resourceManager != null)
        {
            //Task State Machine
            //at TownCenter
            if (!inventoryIsFull)
            {
                if (agent.isStopped == true && !isBringingBack)
                {
                    Debug.Log("HOER HJ");
                    Invoke("GatherRessources", gatherWaitSeconds);
                    isGathering = true;
                }
            }
            //at TownCenter
            else
            {
                if (agent.isStopped == true && !isGathering)
                {
                    BringBackRessources();

                    inventory      = 0;
                    isBringingBack = true;
                }
            }
        }


        #region UnitSelection
        // If we press the left mouse button, begin selection and remember the location of the mouse
        if (Input.GetMouseButtonDown(0))
        {
            isSelecting    = true;
            mousePosition1 = Input.mousePosition;

            //check if List is empty , otherwise empty it
            foreach (var selectableObject in FindObjectsOfType <SelectableUnitComponents>())
            {
                if (selectableObject.selectionCircle != null)
                {
                    Destroy(selectableObject.selectionCircle.gameObject);
                    selectableObject.selectionCircle = null;
                }
            }
        }
        // If we let go of the left mouse button, end selection
        if (Input.GetMouseButtonUp(0))
        {
            //create a new List "selectedObjects" and add "selectableObjects" within 'selection bounds'
            var selectedObjects = new List <SelectableUnitComponents>();
            foreach (var selectableObject in FindObjectsOfType <SelectableUnitComponents>())
            {
                if (IsWithinSelectionBounds(selectableObject.gameObject))
                {
                    selectedObjects.Add(selectableObject);
                    Debug.Log("Selected Objects Count: " + selectedObjects.Count);

                    //activate movement on selectedThings //überrest aus mech?!
                    VillagerController villagerController = selectableObject.GetComponent <VillagerController>();
                    if (villagerController != null)
                    {
                        villagerController.isSelected = true;
                    }
                }
            }


            //string builder [nochmal anschauen]
            var sb = new StringBuilder();
            sb.AppendLine(string.Format("Selecting [{0}] Units", selectedObjects.Count));
            foreach (var selectedObject in selectedObjects)
            {
                sb.AppendLine("-> " + selectedObject.gameObject.name);
            }
            Debug.Log(sb.ToString());

            isSelecting = false;
        }

        // Highlight all objects within the selection box
        //buggy :b
        if (isSelecting)
        {
            foreach (var selectableObject in FindObjectsOfType <SelectableUnitComponents>())
            {
                if (IsWithinSelectionBounds(selectableObject.gameObject))
                {
                    if (selectableObject.selectionCircle == null)
                    {
                        selectableObject.selectionCircle = Instantiate(selectionCirclePrefab);
                        selectableObject.selectionCircle.transform.SetParent(selectableObject.transform, false);
                        selectableObject.selectionCircle.transform.eulerAngles = new Vector3(90, 0, 0);
                    }
                }
                else
                {
                    if (selectableObject.selectionCircle != null)
                    {
                        Destroy(selectableObject.selectionCircle.gameObject);
                        selectableObject.selectionCircle = null;
                    }
                }
            }
        }
    }
Esempio n. 27
0
        public override void Initialize()
        {
            BoutonChoixSoundtrack = new BoutonDeMenu(Jeu, new Vector2(Atelier.TAILLE_ÉCRAN.X / 4, Atelier.TAILLE_ÉCRAN.Y / 4), BoutonDeMenu.TAILLE_BOUTONS);
            MessageSoundtrack = new Message(Jeu, "Soundtrack", BoutonChoixSoundtrack.Position);

            ListeDesOptions = new List<GameComponent>();
            ListeDesOptions.Add(BoutonChoixSoundtrack);
            ListeDesOptions.Add(MessageSoundtrack);
            ListeDesOptions.Add(Jeu.MainMenu.BoutonBack);
            ListeDesOptions.Add(Jeu.MainMenu.MessageBack);

            GestionnaireDeFX = Jeu.Services.GetService(typeof(RessourcesManager<SoundEffect>)) as RessourcesManager<SoundEffect>;
            GestionnaireDeFX = new RessourcesManager<SoundEffect>(Jeu, "Soundtracks/" + NomSoundtrack);

            NomSoundtrack = DEFAULT;
            base.Initialize();

            foreach (GameComponent gc in ListeDesOptions)
            {
                Jeu.Components.Add(gc);
            }
        }
Esempio n. 28
0
 protected override void LoadContent()
 {
     CaméraJeu = Game.Services.GetService(typeof(Caméra)) as Caméra;
     GestionnaireDeModèles = Game.Services.GetService(typeof(RessourcesManager<Model>)) as RessourcesManager<Model>;
     GestionTextures = Game.Services.GetService(typeof(RessourcesManager<Texture2D>)) as RessourcesManager<Texture2D>;
     GestionEffets = Game.Services.GetService(typeof(RessourcesManager<Effect>)) as RessourcesManager<Effect>;
     Modèle = GestionnaireDeModèles.Find(NomModèle);
     TextureModèle = GestionTextures.Find(NomTexture);
     EffetShader = GestionEffets.Find(NomEffet);
     TransformationsModèle = new Matrix[Modèle.Bones.Count];
     Modèle.CopyAbsoluteBoneTransformsTo(TransformationsModèle);
     base.LoadContent();
 }
    void Start()
    {
        data             = GameObject.Find("GameManager").GetComponent <Data>();
        ResourcesManager = GameObject.Find("GameManager").GetComponent <RessourcesManager>();

        //Ecran de fin d'anné Tiers 1 à 3
        if (data.actualTiers < 4)
        {
            switch (data.actualTiers)
            {
            case 1:
                goals = data.conditionTiers2;
                SoundManager.Instance.ChangeMusic("tier2", 0.8f);
                GameManager.Instance.ResourcesManager.CurrentLimit = GameManager.Instance.data.stockMaxTiers2;
                break;

            case 2:
                goals = data.conditionTiers3;
                SoundManager.Instance.ChangeMusic("tier3", 0.8f);
                GameManager.Instance.ResourcesManager.CurrentLimit = GameManager.Instance.data.stockMaxTiers3;
                break;

            case 3:
                goals = data.conditionTiers4;
                SoundManager.Instance.ChangeMusic("tier4", 0.8f);
                GameManager.Instance.ResourcesManager.CurrentLimit = GameManager.Instance.data.stockMaxTiers4;
                break;

            default:
                Debug.Log("Impossible de récupérer les objectifs");
                break;
            }
            foodGoal.text  = goals[0].ToString();
            woodGoal.text  = goals[1].ToString();
            stoneGoal.text = goals[2].ToString();
            waterGoal.text = goals[3].ToString();

            if (ResourcesManager.Resources[0].Quantity >= goals[0] && ResourcesManager.Resources[1].Quantity >= goals[1] &&
                ResourcesManager.Resources[2].Quantity >= goals[2] && ResourcesManager.Resources[3].Quantity >= goals[3] &&
                data.actualTiers < 4)
            {
                data.actualTiers = data.actualTiers + 1;
            }
        }
        //Ecran fin d'anné Tiers 4
        else
        {
            /* GameObject BesiegeDisplay = GameObject.Find("Siege");
             * if (BesiegeDisplay == null) Debug.Log("SPRITE NULL");
             * BesiegeDisplay.SetActive(true);
             * GameObject BesiegeDisplay = GameObject.Find("Siege");
             * BesiegeDisplay.GetComponent<Image>().enabled=true;
             * GameObject.Find("SpriteSiege").SetActive(true);
             * BesiegeDisplay.SetActive(true);*/
            Time.text         = data.yearsBeforeBesiege.ToString();
            foodGoal.enabled  = false;
            woodGoal.enabled  = false;
            stoneGoal.enabled = false;
            waterGoal.enabled = false;
            antislash         = GameObject.Find("antislash1");
            antislash.SetActive(false);
            antislash = GameObject.Find("antislash2");
            antislash.SetActive(false);
            antislash = GameObject.Find("antislash3");
            antislash.SetActive(false);
            antislash = GameObject.Find("antislash4");
            antislash.SetActive(false);
        }



        playerFood.text  = ResourcesManager.Resources[0].Quantity.ToString();
        playerWood.text  = ResourcesManager.Resources[1].Quantity.ToString();
        playerStone.text = ResourcesManager.Resources[2].Quantity.ToString();
        playerWater.text = ResourcesManager.Resources[3].Quantity.ToString();
    }
Esempio n. 30
0
        //void InitialiserAvatars()
        //{
        //   ListeAvatar = new List<Avatar_>();
        //   ListeAvatar.Add(new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 1 / 60f, 1, manager1));
        //   ListeAvatar.Add(new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 2 / 60f, 2, manager2));
        //   ListeAvatar.Add( new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 3 / 60f, 2, manager2));
        //   ListeAvatar.Add(new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 4 / 60f, 2, manager2));
        //}

        /// <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()
        {
           NbJoueurs = 2;

           TestView1 = new Viewport(0, 0, GameConstants.WindowWidth / 2, GameConstants.WindowHeight);
           TestView2 = new Viewport(GameConstants.WindowWidth / 2, 0, GameConstants.WindowWidth / 2, GameConstants.WindowHeight);

           ModelManager ManagerDeModele = new ModelManager(this);
           IOManager manager1 = new IOManager(this,1);
           IOManager manager2 = new IOManager(this, 2);
           CubeColoré CubeBlanc = new Sol(this, 1f, Vector3.Zero, Vector3.Zero, Color.White, new Vector3(20, 1, 10), 1 / 60f);
           CubeColoré CubeRouge = new Sol(this, 1f, Vector3.Zero, new Vector3(0,1,-5), Color.Red, new Vector3(20, 1.5f, 10), 1 / 60f);
           CubeColoré CubeBleu = new Sol(this, 1f, Vector3.Zero, new Vector3(0, 1, 10), Color.Blue, new Vector3(20, 1.5f, 10), 1 / 60f);
           CubeColoré CubeSol = new Sol(this, 1f, Vector3.Zero, new Vector3(0, -3, 0), Color.Yellow, new Vector3(200, 2, 200), INTERVALLE_CALCUL_STANDARD);
           licorne = new Avatar_(this, "cubefache", new Vector3(0, 10, -1), 1 / 60f, 1, manager1);
           Avatar_ licorne2 = new Avatar_(this, "unicorn", new Vector3(0, 10, -1), 1 / 60f, 2, manager2);
           ManagerÉcranDEBUG = new ScreenManager(this, Vector2.Zero);

           Vector3 positionCaméra = new Vector3(10,10,10);
           Vector3 positionObjet = new Vector3(0, 0, 0);
           Vector3 rotationObjet = new Vector3(0, MathHelper.PiOver2, 0);

           GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
           GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
           GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
           spriteBatch = new SpriteBatch(GraphicsDevice);
           GestionInput = new InputManager(this);
           CaméraJeu = new CaméraFixe(this,new Vector3(10,10,10),Vector3.Zero,Vector3.Up);
           Caméra1 = new CaméraAvatar(this, licorne.Position, Vector3.Up, licorne,TestView1);
           Caméra2 = new CaméraAvatar(this, licorne.Position, Vector3.Up, licorne2, TestView2);
           defaut = GraphicsDevice.Viewport;


           //Components.Add(new ArrièrePlanDéroulant(this, "CielÉtoilé", INTERVALLE_CALCUL_STANDARD));
           //Components.Add(new ObjetDeBase(this, "unicorn", 10, rotationObjet, positionObjet));
           Components.Add(new AfficheurFPS(this, "Arial20", Color.Chartreuse, INTERVALLE_CALCUL_FPS));
           Components.Add(new Afficheur3D(this));
           Components.Add(GestionInput);
           Components.Add(Caméra1);
           Components.Add(Caméra2);
           Components.Add(CaméraJeu);
           //Components.Add(CubeBlanc);
           //Components.Add(CubeRouge);
           //Components.Add(CubeBleu);
           Components.Add(manager1);
           Components.Add(manager2);
           Components.Add(ManagerDeModele);
           //Components.Add(licorne);
           //Components.Add(licorne2);

           ManagerDeModele.AjouterModele(CubeBlanc);
           ManagerDeModele.AjouterModele(CubeBleu);
           ManagerDeModele.AjouterModele(CubeRouge);
           ManagerDeModele.AjouterModele(CubeSol);
           ManagerDeModele.AjouterModele(licorne);
           ManagerDeModele.AjouterModele(licorne2);
           ManagerDeModele.AjouterCaméra(Caméra1);
           ManagerDeModele.AjouterCaméra(Caméra2);

           Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
           Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
           Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
           Services.AddService(typeof(InputManager), GestionInput);
           Services.AddService(typeof(Caméra), CaméraJeu);
           Services.AddService(typeof(SpriteBatch), spriteBatch);
           base.Initialize();

           ListePhysique = new List<ICollisionable>();
           ListePhysique.Add(CubeBlanc as ICollisionable);
           ListePhysique.Add(CubeRouge as ICollisionable);
           ListePhysique.Add(licorne as ICollisionable);
           ListePhysique.Add(CubeBleu as ICollisionable);
           ListePhysique.Add(licorne2 as ICollisionable);
           ListePhysique.Add(CubeSol as ICollisionable);


           ManagerÉcranDEBUG.Initialize();
           ManagerÉcranDEBUG.AjouterItem(licorne);
           ManagerÉcranDEBUG.AjouterItem(licorne2);

           CubeBlanc.InitialiserSommets(Color.White);
           CubeBleu.InitialiserSommets(Color.Blue);
           CubeRouge.InitialiserSommets(Color.Red);
        }
Esempio n. 31
0
        protected override void Initialize()
        {
            TAILLE_ÉCRAN = new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            GestionSprites = new SpriteBatch(GraphicsDevice);
            GestionInput = new InputManager(this);
            GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
            GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Font");
            GestionnaireDeSongs = new RessourcesManager<Song>(this, "Soundtracks");
            GestionnaireDeFX = new RessourcesManager<SoundEffect>(this, "Soundtracks/Default");

            ChansonMenuPrincipal = GestionnaireDeSongs.Find("Wake Me Up - Avicii");

            MediaPlayer.Play(ChansonMenuPrincipal);
            MediaPlayer.Volume = 0.25f;

            MainMenu = new MenuPrincipal(this);
            SinglePlayerMenu = new MenuJouer(this);

            Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
            Services.AddService(typeof(SpriteBatch), GestionSprites);
            Services.AddService(typeof(InputManager), GestionInput);
            Services.AddService(typeof(RessourcesManager<SoundEffect>),GestionnaireDeFX);
            Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);

            Components.Add(MainMenu);
            Components.Add(GestionInput);

            base.Initialize();
        }
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     gestionnaireDeSoundEffect = Game.Services.GetService(typeof(RessourcesManager<SoundEffect>)) as RessourcesManager<SoundEffect>;
     gestionnaireDeSong = Game.Services.GetService(typeof(RessourcesManager<Song>)) as RessourcesManager<Song>;
     base.Initialize();
 }
Esempio n. 33
0
    public void NewDay()
    {
        Environnement.Instance.UpdateEnvironnement();
        Inventaire.Instance.AddLastDayRessources();

        int qteNourritureBesoin = Mathf.RoundToInt((CampementData.Instance.nbSurvivant + CampementData.Instance.soldats.Count * 4) * RessourcesManager.RatioBesoin());
        int qteNourritureFestin = Mathf.RoundToInt((CampementData.Instance.nbSurvivant + CampementData.Instance.soldats.Count * 6) * RessourcesManager.RatioFestin());

        if (Inventaire.Instance.qteNourriture >= qteNourritureBesoin)
        {
            if (Inventaire.Instance.qteNourriture >= qteNourritureFestin)
            {
                Inventaire.Instance.qteNourriture -= qteNourritureFestin;
                foreach (Soldat s in CampementData.Instance.soldats)
                {
                    s.buffCombattant.TropDeNourriture();
                }
            }
            else
            {
                Inventaire.Instance.qteNourriture -= qteNourritureBesoin;
                foreach (Soldat s in CampementData.Instance.soldats)
                {
                    s.buffCombattant.NourritureOk();
                }
            }

            CampementData.Instance.survivantContent = true;
        }
        else
        {
            int nourritureManquante = qteNourritureBesoin - Inventaire.Instance.qteNourriture;
            Inventaire.Instance.qteNourriture = 0;
            foreach (Soldat s in CampementData.Instance.soldats)
            {
                s.buffCombattant.PasAssezDeNourriture();
            }
            Famine(nourritureManquante);
        }

        CampementData.Instance.nbSurvivantNonOccupé = CampementData.Instance.nbSurvivant;
        ResetDropDownOption();
    }
Esempio n. 34
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()
      {
         NbJoueurs = 2;
         ListeAvatar = new List<Avatar>();
         ListeManagerControle = new List<IOManager>();
         ListeCaméraAvatars = new List<Caméra>();
         ModelManager ManagerDeModele = new ModelManager(this);
         ManagerÉcranDEBUG = new ScreenManager(this, Vector2.Zero);
         ViewPortDefaut = GraphicsDevice.Viewport;
         CaméraJeu = new CaméraFixe(this, new Vector3(10, 10, 10), Vector3.Zero, Vector3.Up);
         GénérerViewports(NbJoueurs);

         for (int i = 0; i < NbJoueurs; ++i)
         {
            ListeManagerControle.Add(new IOManager(this, i+1));
         }
         for (int i = 0; i < NbJoueurs; ++i)
         {
            ListeAvatar.Add(new Avatar(this, "unicorn", PositionAvatars[i], new Vector3(1, 1, 1), INTERVALLE_CALCUL_STANDARD, GameConstants.ViePersonnageMax, i+1, ListeManagerControle[i]));
         }
         for (int i = 0; i < NbJoueurs; ++i)
         {
            ListeCaméraAvatars.Add(new CaméraAvatar(this, ListeAvatar[i].Position, Vector3.Up, ListeAvatar[i] as Avatar, ListeViewports[i]));
         }

         CubeColoré CubeBlanc = new Sol(this, 1f, Vector3.Zero, Vector3.Zero, Color.White, new Vector3(20, 2, 10), 1 / 60f);
         CubeColoré CubeRouge = new Sol(this, 1f, Vector3.Zero, new Vector3(0, 1, -5), Color.Red, new Vector3(20, 2f, 10), 1 / 60f);
         CubeColoré CubeBleu = new Sol(this, 1f, Vector3.Zero, new Vector3(0, 1f, 10), Color.Blue, new Vector3(20, 2f, 10), 1 / 60f);
         CubeColoré CubeSol = new Sol(this, 1f, Vector3.Zero, new Vector3(0, -1, 0), Color.Yellow, new Vector3(200, 2, 200), INTERVALLE_CALCUL_STANDARD);
         CubeColoré testCollision = new Sol(this, 1, Vector3.Zero, new Vector3(0, -1, 0), Color.Aqua, new Vector3(4, 2, 4), INTERVALLE_CALCUL_STANDARD);

         GestionnaireDeFonts = new RessourcesManager<SpriteFont>(this, "Fonts");
         GestionnaireDeTextures = new RessourcesManager<Texture2D>(this, "Textures");
         GestionnaireDeModèles = new RessourcesManager<Model>(this, "Models");
         spriteBatch = new SpriteBatch(GraphicsDevice);
         GestionInput = new InputManager(this);

         Components.Add(new AfficheurFPS(this, "Arial20", Color.Chartreuse, INTERVALLE_CALCUL_FPS));
         Components.Add(new Afficheur3D(this));
         Components.Add(GestionInput);
         Components.Add(CaméraJeu);
         Components.Add(ManagerDeModele);
         foreach (IOManager i in ListeManagerControle)
            Components.Add(i);
         foreach (Caméra c in ListeCaméraAvatars)
            Components.Add(c);

         ManagerDeModele.AjouterAvatars(ListeAvatar);
         ManagerDeModele.AjouterCaméra(ListeCaméraAvatars);
         ManagerDeModele.AjouterModele(CubeBlanc);
         ManagerDeModele.AjouterModele(CubeBleu);
         ManagerDeModele.AjouterModele(CubeRouge);
         ManagerDeModele.AjouterModele(testCollision);
         ManagerDeModele.AjouterModele(CubeSol);

         Services.AddService(typeof(RessourcesManager<SpriteFont>), GestionnaireDeFonts);
         Services.AddService(typeof(RessourcesManager<Texture2D>), GestionnaireDeTextures);
         Services.AddService(typeof(RessourcesManager<Model>), GestionnaireDeModèles);
         Services.AddService(typeof(InputManager), GestionInput);
         Services.AddService(typeof(Caméra), CaméraJeu);
         Services.AddService(typeof(SpriteBatch), spriteBatch);
         base.Initialize();

         ListePhysique = new List<ICollisionable>();
         foreach(Avatar a in ListeAvatar)
            ListePhysique.Add(a as ICollisionable);

         ListePhysique.Add(CubeBlanc as ICollisionable);
         ListePhysique.Add(CubeRouge as ICollisionable);
         ListePhysique.Add(CubeBleu as ICollisionable);
         ListePhysique.Add(CubeSol as ICollisionable);
         ListePhysique.Add(testCollision as ICollisionable);

         ManagerÉcranDEBUG.Initialize();
         foreach (Avatar a in ListeAvatar)
            ManagerÉcranDEBUG.AjouterItem(a);

         CubeBlanc.InitialiserSommets(Color.White);
         CubeBleu.InitialiserSommets(Color.Blue);
         CubeRouge.InitialiserSommets(Color.Red);
         testCollision.InitialiserSommets(Color.Red);
      }
Esempio n. 35
0
 public override void Update(GameTime gameTime)
 {
     if (Jeu.MainMenu.BoutonBack.IsClicked)
     {
         Jeu.Components.Add(Jeu.MainMenu);
         foreach (GameComponent gc in ListeDesOptions)
         {
             Jeu.Components.Remove(gc);
         }
         Jeu.GestionnaireDeFX = GestionnaireDeFX;
         Jeu.Services.RemoveService(typeof(RessourcesManager<SoundEffect>));
         Jeu.Services.AddService(typeof(RessourcesManager<SoundEffect>), GestionnaireDeFX);
         Jeu.Components.Remove(this);
     }
     if (BoutonChoixSoundtrack.IsClicked)
     {
         CompteurSoundtrack = (CompteurSoundtrack + 1) % 5;
         switch (CompteurSoundtrack)
         {
             case 0:
                 NomSoundtrack = DEFAULT;
                 break;
             case 1:
                 NomSoundtrack = DANEAU;
                 break;
             case 2:
                 NomSoundtrack = BOUSQUET;
                 break;
             case 3:
                 NomSoundtrack = CABANAS;
                 break;
             case 4:
                 NomSoundtrack = TREMBLAY;
                 break;
         }
         GestionnaireDeFX = new RessourcesManager<SoundEffect>(Jeu, "Soundtracks/" + NomSoundtrack);
         Jeu.ClickBouton = GestionnaireDeFX.Find("Nom");
         Jeu.ClickBouton.Play();
     }
     base.Update(gameTime);
 }