Esempio n. 1
0
 public Plane(Flyable flyable)
 {
     _flyable            = flyable;
     this.EngineSize     = 6000;
     this.NumberOfWheels = 8;
     _flyable.Fly("plane");
 }
Esempio n. 2
0
        protected virtual void ReadFromXml()
        {
            XmlDocument document = new XmlDocument();

            document.Load(Settings.GenerateStreamingPath("System/Difficulty/Hypothetical/Enemy.xml"));
            var        enemyList = document.SelectSingleNode("Enemies").ChildNodes;
            XmlElement thisEnemy = null;

            for (int i = 0; i < enemyList.Count; i++)
            {
                if ((enemyList[i] as XmlElement).GetAttribute("name").Equals(uniqueEnemyName))
                {
                    thisEnemy = enemyList[i] as XmlElement;
                    break;
                }
            }
            if (thisEnemy == null)
            {
                throw new UnityException($"Cannot find {uniqueEnemyName} in Hypothetical difficulty.");
            }
            var attributeList = thisEnemy.ChildNodes;

            var basic = attributeList[0] as XmlElement;

            initHealth    = Int32.Parse(basic.GetAttribute("health"));
            currentHealth = initHealth;
            initSpeed     = Single.Parse(basic.GetAttribute("speed"));
            currentSpeed  = initSpeed;
            initDamage    = Int32.Parse(basic.GetAttribute("damage"));
            currentDamage = initDamage;

            var typeInfo = attributeList[1] as XmlElement;

            type    = GetSize(typeInfo.GetAttribute("size"));
            flyable = GetFlyable(typeInfo.GetAttribute("flyable"));

            var reward = attributeList[2] as XmlElement;

            rewardcash = Int32.Parse(reward.GetAttribute("dosh"));
            rewardExp  = Int32.Parse(reward.GetAttribute("exp"));

            var damageFacotr = attributeList[3] as XmlElement;

            resistance = new Dictionary <Turret.DamageType, float>
            {
                { Turret.DamageType.Bullet, Single.Parse(damageFacotr.GetAttribute("bullet")) },
                { Turret.DamageType.Explosive, Single.Parse(damageFacotr.GetAttribute("explosive")) },
                { Turret.DamageType.Flame, Single.Parse(damageFacotr.GetAttribute("flame")) },
                { Turret.DamageType.Microwave, Single.Parse(damageFacotr.GetAttribute("bullet")) },
                { Turret.DamageType.Nuclear, Single.Parse(damageFacotr.GetAttribute("microwave")) },
                { Turret.DamageType.Tesla, Single.Parse(damageFacotr.GetAttribute("tesla")) }
            };
        }
Esempio n. 3
0
 public string Fly()
 {
     return(Flyable.Fly());
 }
Esempio n. 4
0
 public void PerformFly(string duckName)
 {
     Flyable.Fly(duckName);
 }
 public FlyableActionPerformer(Node2D item) : base(item)
 {
     flyable          = (Flyable)item;
     Flyable.Crashed += finishAction;
 }