Example #1
0
 public void spriteEnter(UnitInterface mainguy)
 {
     Point spriteSize = mainguy.getSize();
     //Set sprite to position just in front of the door
     mainguy.loc = new Point(377, drawLoc.Y + size.Y + 5 - spriteSize.Y);
     mainguy.showDown();
 }
Example #2
0
 public void EditUnitState(int x, int y, UnitInterface unit, bool isAdd)
 {
     if (ValidateNodeIndex(x, y))
     {
         if (unit.GetType() == typeof(TowerUnit))
         {
             if (isAdd)
             {
                 allTowerUnit.Add((TowerUnit)unit);
                 tilenodes[x, y].towerUnit = (TowerUnit)unit;
             }
             else
             {
                 if (tilenodes[x, y].towerUnit == (TowerUnit)unit)
                 {
                     tilenodes[x, y].towerUnit = null;
                     allTowerUnit.Remove((TowerUnit)unit);
                 }
             }
         }
         else
         {
             if (isAdd)
             {
                 tilenodes[x, y].AddMonsterUnit((MonsterUnit)unit);
             }
             else
             {
                 tilenodes[x, y].RemoveMonsterUnit((MonsterUnit)unit);
             }
         }
     }
 }
Example #3
0
        private UnitInterface unit; //For passing to items when using.

        #endregion Fields

        #region Constructors

        public Inventory(UnitInterface unit)
        {
            items  = new Item[limit];
            this.unit = unit;
            for (int i = 0; i < items.Length; i++)
                items[i] = new Item("nothing", null);
        }
Example #4
0
 public DialogueHandler(Texture2D bubbles, GraphicsDevice graphics, SpriteFont font, UnitInterface sprite)
 {
     this.bubbles = bubbles;
     this.batch = new SpriteBatch(graphics);
     this.sprite = sprite;
     this.font = font;
     this.descSub = "";
     this.textColor = Color.Black;
     this.destinations = new Rectangle[source.Length];
     this.show = false;
 }
Example #5
0
        public void RemoveUnit(UnitInterface unit)
        {
            pendingDestroyList.Add(unit);

            string unitID = GetUnitIDByType(unit);

            if (unitID != null)
            {
                UnitCountDict = GeneralUtility.DictionaryIncrement <string>(UnitCountDict, unitID, -1);
                UnitValueDict = GeneralUtility.DictionaryIncrement <string>(UnitValueDict, unitID, -unit.unitStats.value);
            }
        }
Example #6
0
 public Inventory(UnitInterface unit, ItemInterface[] items)
 {
     //testing
     this.items = new Item[limit];
     for (int f = 0; f < items.Length; f++)
         this.items[f] = items[f];
     this.unit = unit;
     //Just for testing
     for (int i = items.Length; i < limit; i++)
     {
         this.items[i] = new Item("nothing", null);
     }
 }
Example #7
0
        private string GetUnitIDByType(UnitInterface p_unit)
        {
            if (p_unit.GetType() == typeof(MonsterUnit))
            {
                return(VariableFlag.Pooling.MonsterID);
            }

            if (p_unit.GetType() == typeof(TowerUnit))
            {
                return(VariableFlag.Pooling.TowerID);
            }

            return(null);
        }
Example #8
0
        public void AddUnit(UnitInterface unit)
        {
            unit.ReadyToAction(RemoveUnit);

            unitList.Add(unit);
            unitLength++;

            string unitID = GetUnitIDByType(unit);

            if (unitID != null)
            {
                UnitCountDict = GeneralUtility.DictionaryIncrement <string>(UnitCountDict, unitID, 1);
                UnitValueDict = GeneralUtility.DictionaryIncrement <string>(UnitValueDict, unitID, unit.unitStats.value);
            }
        }
Example #9
0
        public static GameDamageManager.DMGRegistry GetDMGRegisterCard(UnitInterface target, UnitInterface fromUnit, UnitStats unitStats, float fireTime, float timeToDst)
        {
            GameDamageManager.DMGRegistry damageRequest = new GameDamageManager.DMGRegistry();

            damageRequest.fireTime = fireTime;

            damageRequest.timeToDest = timeToDst;

            damageRequest.unitStats = unitStats;

            damageRequest.target = target;

            damageRequest.fromUnit = fromUnit;

            return(damageRequest);
        }
Example #10
0
 public Level(GraphicsDevice graphicsDevice, String map, int[] whys, List<Wall> walls, ContentManager Content, UnitInterface sprite, ObjectInterface[] objects, PlayerActionsInterface actions)
 {
     //Load Properties
     this.graphicsDevice = graphicsDevice;
     this.mapTexture = Content.Load<Texture2D>(map);
     this.walls = walls;
     this.whys = whys;
     this.actions = actions;
     this.objects = objects;
     this.mainguy = sprite;
     this.boundary = false;
     mapName = map;
     batch = new SpriteBatch(graphicsDevice);
     font = Content.Load<SpriteFont>("cheese serif");
     speed = 5;
     update();
 }
Example #11
0
 public EnumMethods(LevelInterface level, UnitInterface mainguy)
 {
     this.level = level;
     this.mainguy = mainguy;
 }
Example #12
0
 public Scare(UnitInterface mainGuy, Point[] loc, int why)
 {
     this.mainGuy = mainGuy;
     this.locations = loc;
     this. why = why;
 }
Example #13
0
 protected override void LoadContent()
 {
     Rectangle dicks = new Rectangle();
     Vector2 ass;
     dicks.X = (int)ass.X;
     dicks.Y = (int)ass.Y;
     test[0] = new Item("test", Content.Load<Texture2D>("testimg"));
     // Create a new SpriteBatch, which can be used to draw textures.
     loader = new Loader(Content, GraphicsDevice);
     font = Content.Load<SpriteFont>("cheese serif");
     mainguy = loader.getSpriteExt();
     dialogueHandler = new DialogueHandler(Content.Load<Texture2D>("bubbles"), GraphicsDevice, font, mainguy);
     inventory = new Inventory(mainguy, test);
     uis = new UIManager(loader.getInventoryWindow(inventory));
     playerActions = new PlayerActions(mainguy, dialogueHandler);
     levels = loader.getLevelExt(mainguy, playerActions);
     backgroundMusic = Content.Load<Song>("test");
     currentLevel = levels[loader.getLevelIntExt()];
     currentLevel.setLoc(loader.getSaveCoords());
     playerActions.level = currentLevel;
     area = loader.getAreaExt();
     MediaPlayer.IsRepeating = true;
     MediaPlayer.Play(backgroundMusic);
     // TODO: use this.Content to load your game content here
 }