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); }
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; }