예제 #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);
        }
예제 #2
0
파일: Tower.cs 프로젝트: preetum/archive
        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);
        }
예제 #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;
        }
예제 #4
0
        public FatherUnit(UnitTypeInfo info, string type, Vector2 pos)
            : base(UnitConverter.CreatePolygon(info.Polygon, pos))
        {
            this.Position = polygon.Center;
            this.Inertia  = info.Inertia;
            fullHp        = info.Health;
            Health        = info.Health;
            Defense       = new Damage(info.Defense);

            if ((info.Attacks.Length > 0) && !info.Attacks[0].Null)
            {
                mele = new ArealAttack(info.Attacks[0], this);
            }
            if (info.SpawnAttacks.Length != 0)
            {
                spAtk = new SpawnAttack(info.SpawnAttacks[0], this);
            }

            this.Type       = type;
            this.workPerSec = info.WorkPower;
            this.workPd     = info.WorkPeriod;

            this.MaxSpeed       = info.Speed;
            this.AI             = UnitConverter.CreateAI(info.AIType, this, MaxSpeed);
            this.CollisionClass = UnitConverter.CreateCollisionType(info.CollisionType);

            IdleAnimation   = UnitConverter.CreateAnimation(polygon, info.IdleAnimation);
            MoveAnimation   = UnitConverter.CreateAnimation(polygon, info.MoveAnimation);
            WorkAnimation   = UnitConverter.CreateAnimation(polygon, info.WorkAnimation);
            MeleeAnimation  = UnitConverter.CreateAnimation(polygon, info.MeleeAnimation);
            RangedAnimation = UnitConverter.CreateAnimation(polygon, info.RangedAnimation);

            SetBaseAnimation(IdleAnimation);

            this.SightRange = info.SightRange;

            unitMenu            = new ActorMenu(this);
            unitMenu.DisplayBar = true;

            IsRotatable = info.Rotatable;

            DrawDepth = Omron.Framework.DrawPriority.UnitDepth;
        }
예제 #5
0
        void createMenu()
        {
            menuConv = new List <byte>();//action[menuConv[i]] is what the i'th button does

            for (byte i = 0; i < actions.Count; i++)
            {
                if ((unlocksNeeded[i] == "") || (Faction.ResearchUnlocked.Contains(unlocksNeeded[i])))
                {
                    if (actionTypes[i] == ActionType.unit)
                    {//unit && unit is unlocked
                        menuConv.Add(i);
                    }
                    else if (actionTypes[i] == ActionType.building)
                    {
                        if (!Faction.BuildingsUnlocked.Contains(actions[i]))
                        {
                            menuConv.Add(i);
                        }
                    }
                    else if (actionTypes[i] == ActionType.unlock)
                    {
                        if (!Faction.ResearchUnlocked.Contains(actions[i]))
                        {
                            menuConv.Add(i);
                        }
                    }
                }
            }

            string[] menuStrs = new string[menuConv.Count];
            for (byte i = 0; i < menuStrs.Length; i++)
            {
                int curInd = menuConv[i];
                menuStrs[i] = actions[curInd] + "\n" + createResourceDesc(costs[curInd]);
            }
            menu = new ActorMenu(this, menuStrs);
            menu.CommandInvoked += new MenuItemPressed(menu_ItemClicked);
            OnUpdateMenu(this);
        }