Exemplo n.º 1
0
        public FatherBuilding(BuilduingTypeInfo info, string type, Vector2 pos)
            : base(UnitConverter.CreatePolygon(info.Polygon, pos))
        {
            this.Position = polygon.Center;
            fullHp        = info.Health;
            Defense       = new Damage(info.Defense);
            //SpriteData = ResourceManager.CreateSpData(info.DrawInfo, polygon);
            this.Type  = type;
            this.wNeed = info.WorkNeeded;
            wDone      = 0;

            this.SightRange = info.SightRange;

            IdleAnimation  = UnitConverter.CreateAnimation(polygon, info.IdleAnimation);
            BuildAnimation = UnitConverter.CreateAnimation(polygon, info.BuildAnimation);
            WorkAnimation  = UnitConverter.CreateAnimation(polygon, info.WorkAnimation);
            SetBaseAnimation(BuildAnimation);
            BuildAnimation.Stop();
            buildMenu            = new ActorMenu(this);
            buildMenu.DisplayBar = true;
            Health = 1;

            DrawDepth      = Omron.Framework.DrawPriority.BuildingDepth;
            this.Attacked += new AttackedEventHandler(changeAnim);
        }
Exemplo n.º 2
0
        public Tower(BuilduingTypeInfo info, string type, Vector2 pos)
            : base(info, type, pos)
        {
            string[] coms = new string[info.Attacks.Length + info.SpawnAttacks.Length];


            meleAtks = new ArealAttack[info.Attacks.Length];
            int count = 0;

            foreach (AttackTypeInfo atk in info.Attacks)
            {
                coms[count]     = "Mele " + count;
                meleAtks[count] = new ArealAttack(atk, this);
                count++;
            }

            spawnAtks = new SpawnAttack[info.SpawnAttacks.Length];
            count     = 0;
            foreach (SpawnAttackTypeInfo atk in info.SpawnAttacks)
            {
                coms[count + meleAtks.Length] = atk.SpawnActor + "-" + atk.Number;
                spawnAtks[count] = new SpawnAttack(atk, this);
                count++;
            }

            menu = new ActorMenu(this, coms);
            menu.CommandInvoked += new MenuItemPressed(menu_CommandInvoked);
            curSpawn             = 0;
            curMele              = 0;
            updateMenuInfo();

            AI = new TowerAI(this);
        }
Exemplo n.º 3
0
        public Resource(BuilduingTypeInfo info, string type, Vector2 loc)
            : base(info, type, loc)
        {
            this.Attacked += new AttackedEventHandler(Resource_Attacked);
            if (info.SubTypeCosts.Length < 1)
            {
                throw new Exception("Resources must have one SubTypeCosts broham!");
            }
            resources = UnitConverter.CreateResourceData(info.SubTypeCosts[0]);

            menu      = new ActorMenu(this);
            menu.Info = "     " + UnitConverter.CreateResourceDescription(resources) + "\n\nResource left: " + this.Health;

            IsInvalid = false;
            DrawDepth = DrawPriority.WallDepth;
        }
Exemplo n.º 4
0
    {//factory unit
        public ActionCenter(BuilduingTypeInfo info, string type, Vector2 loc, Faction f)
            : base(info, type, loc)
        {
            if ((info.SubTypeCosts.Length != info.SubTypes.Length) || (info.ActionTimes.Length != info.SubTypes.Length))
            {
                throw new Exception("Unit Subtypes must have the same length as SubTypeCosts and as ActionTimes!!");
            }
            this.Faction = f;

            elapsedTime = 0;

            queue = new Queue <byte>();
            createActions(info);
            createMenu();
            createDefaultRally();
        }
Exemplo n.º 5
0
        void createActions(BuilduingTypeInfo info)
        {
            actionTimes   = new List <float>();
            actions       = new List <string>();
            costs         = new List <ResourceData>();
            actionTypes   = new List <ActionType>();
            unlocksNeeded = new List <string>();

            for (int i = 0; i < info.SubTypes.Length; i++)
            {
                actionTimes.Add(info.ActionTimes[i]);
                actions.Add(info.SubTypes[i]);
                costs.Add(UnitConverter.CreateResourceData(info.SubTypeCosts[i]));
                actionTypes.Add((ActionType)info.ActionTypes[i]);
                unlocksNeeded.Add(info.UnlocksNeeded[i]);
            }
            //by the way, if there is an error here check your xml
        }
Exemplo n.º 6
0
 public Wall(BuilduingTypeInfo info, string type, Vector2 loc)
     : base(info, type, loc)
 {
     DrawDepth = Omron.Framework.DrawPriority.WallDepth;
 }