예제 #1
0
        public Zeeman(IEnergy energy)
        {
            this.InitializeComponent(energy);
#if DEBUG
            this.AttachDevTools();
#endif
        }
예제 #2
0
        public Exchange(IEnergy energy)
        {
            this.InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
        }
예제 #3
0
        public Anisotropy(IEnergy energy)
        {
            InitializeComponent(energy);
#if DEBUG
            this.AttachDevTools();
#endif
        }
예제 #4
0
 private void InitializeComponent(IEnergy energy = null)
 {
     AvaloniaXamlLoader.Load(this);
     DataContext = new ExchangeViewModel(energy)
     {
         Close = Close
     };
 }
예제 #5
0
 private void InitializeComponent(IEnergy energy = null)
 {
     AvaloniaXamlLoader.Load(this);
     DataContext = new AnisotropyViewModel(energy)
     {
         Close = this.Close
     };
 }
예제 #6
0
        public void AddEnergyPart(IEnergy energy, EnergyType type, double directionX, double directionY
                                  , double directionZ, IColor color, double value, string region)
        {
            var energyPart = _creator.Create(type, directionX, directionY, directionZ, color, value
                                             , region);

            AddEnergyPart(energy, energyPart);
        }
예제 #7
0
 public void Delete(IEnergy energy)
 {
     if (energy != null)
     {
         DataStorage.ObjectContainer.Delete(energy);
         OnPropertyChanged(nameof(EnergiesNames));
     }
 }
예제 #8
0
        /// <summary>
        /// Возвращает значение энергии элемента
        /// </summary>
        /// <param name="BalanceItem">Элемент баланса</param>
        /// <param name="energyDirection">Направление энергии</param>
        /// <returns>Значение энергии</returns>
        private double?GetEnergyValueForBalanceItem(IBalanceItem BalanceItem, BalanceFormula.EnergyDirection energyDirection)
        {
            IEnergy energy = _BalanceItemsEnergy[BalanceItem];
            var     value  = energyDirection == BalanceFormula.EnergyDirection.@in
                ? energy.Plus.CorrectedValue
                : energy.Minus.CorrectedValue;

            return(value);
        }
예제 #9
0
 public void TearDown()
 {
     myShield          = null;
     myHealth          = null;
     myEnergy          = null;
     myOwnBot          = null;
     myEnemyOne        = null;
     myBattleField     = null;
     enemiesCollection = null;
     sut = null;
 }
예제 #10
0
 public void SetUp()
 {
     sut      = new MySuperHero();
     myShield = CreateAndSetupShield();
     SetShieldPercentageAndActualShieldPoints(100);
     myHealth   = CreateAndSetupHealth();
     myEnergy   = CreateAndSetupEnergy();
     myOwnBot   = CreateAndSetupOwnBot(OwnBotInitialPositionX, OwnBotInitialPositionY);
     myEnemyOne = CreateAndSetupEnemy(EnemyOneInitialPositionX, EnemyOneInitialPositionY);
     SetDistanceToEnemy(myEnemyOne);
     myBattleField     = new Mock <IBattlefieldView>().Object;
     enemiesCollection = new List <IEnemy> {
         myEnemyOne
     };
 }
예제 #11
0
 public void LookAt(IEnergy energy, int index = 0)
 {
     if (energy is SpintronicsEnergy)
     {
         var spintronicsEnergy = energy as SpintronicsEnergy;
         if (spintronicsEnergy.GraphicsObjects.Count > 0)
         {
             double x = (spintronicsEnergy.GraphicsObjects[index].FirstPoint.X +
                         spintronicsEnergy.GraphicsObjects[index].LastPoint.X) / 2;
             double y = (spintronicsEnergy.GraphicsObjects[index].FirstPoint.Y +
                         spintronicsEnergy.GraphicsObjects[index].LastPoint.Y) / 2;
             double z = (spintronicsEnergy.GraphicsObjects[index].FirstPoint.Z +
                         spintronicsEnergy.GraphicsObjects[index].LastPoint.Z) / 2;
             GraphicManagement.cameraCommands.MoveTo(x, y, z);
         }
     }
 }
예제 #12
0
파일: Program.cs 프로젝트: Telorath/Capers
        static Character Newcharacter(string name)
        {
            Character C        = new Character();
            IEnergy   ERESERVE = C;

            C.Name = name;
            int chance = prng.Next(1, 101);

            if (chance > 30)
            {
                ERESERVE           = new EnergyReserve();
                ERESERVE.MaxEnergy = prng.Next(1, 9) * 10;
                ERESERVE.Energy    = ERESERVE.MaxEnergy;
                (ERESERVE as Power).calculatecost();
                (ERESERVE as Entity).Name        = "Energy Reserve";
                (ERESERVE as EnergyReserve).User = C;
                C.addpower((Power)ERESERVE);
            }
            chance = prng.Next(1, 101);
            if (chance > 20)
            {
                EnergyBlast EBLAST = new EnergyBlast();
                EBLAST.Name         = "Energy Blast";
                EBLAST.Dice         = prng.Next(1, 6);
                EBLAST.EnergySource = ERESERVE;
                EBLAST.DamageClass  = (damageclass)prng.Next(0, Enum.GetNames(typeof(damageclass)).Length + 1);
                EBLAST.DamageType   = (damagetype)prng.Next(0, Enum.GetNames(typeof(damagetype)).Length + 1);
                EBLAST.User         = C;
                EBLAST.calculatecost();
                C.addpower(EBLAST);
            }
            if (chance > 60)
            {
                Armor ARMORPOWER = new Armor();
                ARMORPOWER.Name         = "Armor";
                ARMORPOWER.REDEF        = prng.Next(1, 10);
                ARMORPOWER.RPDEF        = prng.Next(1, 10);
                ARMORPOWER.EnergySource = ERESERVE;
                ARMORPOWER.User         = C;
                ARMORPOWER.calculatecost();
                C.addpower(ARMORPOWER);
            }
            return(C);
        }
 public bool TryParse(string value, out IEnergy output) => Energy.TryParse(value, out output);
예제 #14
0
 public void AddEnergyPart(IEnergy energy, IEnergyPart energyPart)
 {
     FigureContainer.Add(((EnergyPart)energyPart)._graphicsObject);
     ((SpintronicsEnergy)energy).AddEnergyPart(energyPart);
 }
예제 #15
0
 public void DeleteEnergyPart(IEnergy energy, IEnergyPart energyPart)
 {
     FigureContainer.Remove(((EnergyPart)energyPart)._graphicsObject);
     ((SpintronicsEnergy)energy).RemoveEnergyPart(energyPart);
 }
예제 #16
0
 public bool TryParse(string value, out IEnergy output) => throw new NotImplementedException();
예제 #17
0
        public static bool TryParse(string input, out IEnergy output)
        {
            #region Prepare Variables
            string capInput   = input.ToUpperInvariant();
            string extraction = input.ExtractNumberComponentFromMeasurementString();
            double conversion = 0;
            #endregion

            #region Convert To Double
            bool failed = !double.TryParse(extraction, out conversion);
            if (failed)
            {
                Debug.AddDetailMessage("Measurement Input not successfully converted.");
                Debug.AddDetailMessage("----" + capInput);
                output = new Energys.KiloJoule(0);
                return(false);
            }
            #endregion
            #endregion
            #region Convert To Energy
            if (capInput.EndsWithAny(Suffixes.BritishThermalUnit))
            {
                output = new Energys.BritishThermalUnit(conversion);
                return(true);
            }
            if (capInput.EndsWithAny(Suffixes.ElectronVolt))
            {
                output = new Energys.ElectronVolt(conversion);
                return(true);
            }
            if (capInput.EndsWithAny(Suffixes.FoodCalorie))
            {
                output = new Energys.FoodCalorie(conversion);
                return(true);
            }
            if (capInput.EndsWithAny(Suffixes.FootPound))
            {
                output = new Energys.FootPound(conversion);
                return(true);
            }
            if (capInput.EndsWithAny(Suffixes.Joule))
            {
                output = new Energys.Joule(conversion);
                return(true);
            }
            if (capInput.EndsWithAny(Suffixes.KiloJoule))
            {
                output = new Energys.KiloJoule(conversion);
                return(true);
            }
            if (capInput.EndsWithAny(Suffixes.ThermalCalorie))
            {
                output = new Energys.ThermalCalorie(conversion);
                return(true);
            }
            #endregion
            #region ... Conversion
            #region Type Unrecognised
            Debug.AddDetailMessage("No Type for input Energy conversion. Break here for details...");
            Debug.AddDetailMessage("----" + capInput);
            output = new Energys.KiloJoule(0);
            return(false);

            #endregion
        }
예제 #18
0
 public void Add(IEnergy energy)
 {
     DataStorage.ObjectContainer.Add(energy);
     OnPropertyChanged(nameof(EnergiesNames));
 }
예제 #19
0
 public void GetEnergy()
 {
     _energy = EnergyProvider.GetEnergyFor(Kettle);
 }
예제 #20
0
 public void DeleteEnergyPart(IEnergy energy, IEnergyPart energyPart)
 {
     _controller.DeleteEnergyPart(energy, energyPart);//??
     OnPropertyChanged(nameof(EnergiesNames));
 }
 public static bool TryParse(string value, out IEnergy output) => objectFactory.TryParse(value, out output);