Exemplo n.º 1
0
Arquivo: Keep.cs Projeto: MK4H/MHUrho
        public static Keep CreateNew(ILevelManager level, IBuilding building, KeepType myType)
        {
            Keep newKeep = null;

            try {
                newKeep = new Keep(level, building, myType);
                newKeep.CreatePathfindingNodes();
                StaticRangeTarget.CreateNew(newKeep, level, building.Center);
                newKeep.clicker          = Clicker.CreateNew(newKeep, level);
                newKeep.clicker.Clicked += newKeep.KeepClicked;
                newKeep.healthBar        =
                    new HealthBarControl(level, building, 100, new Vector3(0, 3, 0), new Vector2(2f, 0.2f), false);
                newKeep.window = building.Player == level.HumanPlayer ? new KeepWindow(newKeep) : null;
                return(newKeep);
            }
            catch (Exception e) {
                newKeep?.Dispose();
                throw;
            }
        }
Exemplo n.º 2
0
Arquivo: Gate.cs Projeto: MK4H/MHUrho
        public static Gate CreateNew(ILevelManager level, IBuilding building)
        {
            Gate newGate = null;

            try {
                newGate = new Gate(level, building);
                newGate.CreatePathfindingNodes();
                StaticRangeTarget.CreateNew(newGate, level, building.Center);
                newGate.clicker          = Clicker.CreateNew(newGate, level);
                newGate.clicker.Clicked += newGate.OnClicked;
                newGate.healthBar        =
                    new HealthBarControl(level, building, 100, new Vector3(0, 3, 0), new Vector2(2f, 0.2f), false);
                newGate.window = new GateWindow(newGate);

                return(newGate);
            }
            catch (Exception e) {
                newGate?.Dispose();
                throw;
            }
        }