Exemplo n.º 1
0
 public FarmTower(Unit9 unit)
     : base(unit)
 {
     this.tower   = (Tower9)unit;
     this.IsTower = true;
 }
Exemplo n.º 2
0
        private static void AddBuilding(Unit building)
        {
            try
            {
                var newUnit = GetUnitFast(building.Handle);
                if (newUnit != null)
                {
                    return;
                }

                switch (building.NetworkName)
                {
                case "CDOTA_BaseNPC_Tower":
                {
                    newUnit = new Tower9((Tower)building);
                    break;
                }

                case "CDOTA_BaseNPC_Barracks":
                {
                    newUnit = new Building9(building)
                    {
                        IsBarrack = true
                    };
                    break;
                }

                case "CDOTA_BaseNPC_Watch_Tower":
                {
                    newUnit = new Building9(building);

                    if (building.Position.X < 0)
                    {
                        RadiantOutpost = newUnit.Position;
                    }
                    else
                    {
                        DireOutpost = newUnit.Position;
                    }

                    break;
                }

                case "CDOTA_Unit_Fountain":
                {
                    newUnit = new Building9(building)
                    {
                        IsFountain = true
                    };

                    if (newUnit.Team == Owner.Team)
                    {
                        AllyFountain = newUnit.Position;
                    }
                    else
                    {
                        EnemyFountain = newUnit.Position;
                    }

                    break;
                }

                case "CDOTA_BaseNPC_Shop":
                {
                    // ignore
                    return;
                }

                default:
                {
                    newUnit = new Building9(building);
                    break;
                }
                }

                SaveUnit(newUnit);
                unitAdded?.Invoke(newUnit);
            }
            catch (Exception e)
            {
                Logger.Error(e, building);
            }
        }
 // Token: 0x06000362 RID: 866 RVA: 0x0001B5E4 File Offset: 0x000197E4
 private static void AddBuilding(Unit building)
 {
     try
     {
         Unit9 unit = EntityManager9.GetUnitFast(building.Handle);
         if (!(unit != null))
         {
             string networkName = building.NetworkName;
             if (!(networkName == "CDOTA_BaseNPC_Tower"))
             {
                 if (!(networkName == "CDOTA_BaseNPC_Barracks"))
                 {
                     if (!(networkName == "CDOTA_BaseNPC_Healer"))
                     {
                         if (!(networkName == "CDOTA_Unit_Fountain"))
                         {
                             if (networkName == "CDOTA_BaseNPC_Shop")
                             {
                                 return;
                             }
                             unit = new Building9(building);
                         }
                         else
                         {
                             unit = new Building9(building)
                             {
                                 IsFountain = true
                             };
                             if (unit.Team == EntityManager9.Owner.Team)
                             {
                                 EntityManager9.AllyFountain = unit.Position;
                             }
                             else
                             {
                                 EntityManager9.EnemyFountain = unit.Position;
                             }
                         }
                     }
                     else
                     {
                         unit = new Shrine9(building);
                     }
                 }
                 else
                 {
                     unit = new Building9(building)
                     {
                         IsBarrack = true
                     };
                 }
             }
             else
             {
                 unit = new Tower9((Tower)building);
             }
             EntityManager9.units[unit.Handle] = unit;
             EntityManager9.EventHandler <Unit9> eventHandler = EntityManager9.unitAdded;
             if (eventHandler != null)
             {
                 eventHandler(unit);
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, building, null);
     }
 }