コード例 #1
0
ファイル: Enemy.cs プロジェクト: ChocMaltHoney/Neuroleptic
        public Enemy(Enemy other)
            : base(other)
        {
            bAgro = other.bAgro;
            //fWanderTimer = other.fWanderTimer;
            fDamage = other.fDamage;
            pOrbDrop = other.pOrbDrop;
            bDrawHealth = other.bDrawHealth;

            Jitter = other.Jitter;
            CircleDist = other.CircleDist;
            CircleCentre = other.CircleCentre;
            WanderAngle = other.WanderAngle;
            WanderForce = other.WanderForce;
            WanderAngleRand = other.WanderAngleRand;

            fAttackRange = other.fAttackRange;
            fAttackCooldown = other.fAttackCooldown;
            fAttackDamage = other.fAttackDamage;

            pOrbDrop = other.pOrbDrop;
            iChanceDrop = other.iChanceDrop;
            iShootTimer = iShootMax = other.iShootMax;
            fLength = other.fLength;
            fWanderTimer = 0;
            fWanderCooldown = other.fWanderCooldown;

            fAnimationMax = other.fAnimationMax;

            base.UpdateIndex();
        }
コード例 #2
0
 public static Room LoadFile(ContentManager Content, String s_File)
 {
     XmlReaderSettings settings = new XmlReaderSettings();
     settings.ConformanceLevel = ConformanceLevel.Fragment;
     settings.IgnoreWhitespace = true;
     settings.IgnoreComments = true;
     Room instance = new Room();
     using (XmlReader XMLReader = XmlReader.Create(s_File, settings))
     {
         //go through the file finding these nodes and loading them
         while (XMLReader.Read())
         {
             if (XMLReader.IsStartElement())
             {
                 switch (XMLReader.Name)
                 {
                     case "Room":
                         //Console.WriteLine("Start <Room> element.");
                         break;
                     case "AnimatedSprite":
                         //Console.WriteLine("Start <AnimatedSprite> element.");
                         instance.RoomBase = new AnimatedSprite();
                         instance.RoomBase.xmlImport(XMLReader, Content);
                         break;
                     case "Weapon":
                         //Console.WriteLine("Start <Weapon> element.");
                         Items.Weapon wpn = new Items.Weapon();
                         wpn.xmlImport(XMLReader, Content);
                         instance.AddItem(wpn);
                         break;
                     case "Psyche":
                         //Console.WriteLine("Start <Psyche> element.");
                         Items.Psyche psy = new Items.Psyche();
                         psy.xmlImport(XMLReader, Content);
                         instance.AddItem(psy);
                         break;
                     case "Player":
                         //Console.WriteLine("Start <Player> element.");
                         Game1.ePlayer = new Entities.Player(Content);
                         Game1.ePlayer.xmlImport(XMLReader, Content);
                         break;
                     case "Enemy":
                         //Console.WriteLine("Start <Enemy> element.");
                         Entities.Enemy eny = new Entities.Enemy();
                         eny.xmlImport(XMLReader, Content);
                         instance.AddEntity(eny);
                         break;
                     case "BasicEnemy":
                         //Console.WriteLine("Start <BasicEnemy> element.");
                         Entities.BasicEnemy bsceny = new Entities.BasicEnemy();
                         bsceny.xmlImport(XMLReader, Content);
                         instance.AddEntity(bsceny);
                         break;
                     case "SpawnerEnemy":
                         //Console.WriteLine("Start <SpawnerEnemy> element.");
                         Entities.SpawnerEnemy swpeny = new Entities.SpawnerEnemy();
                         swpeny.xmlImport(XMLReader, Content);
                         instance.AddEntity(swpeny);
                         break;
                     case "BossEnemy":
                         //Console.WriteLine("Start <BossEnemy> element.");
                         Entities.BossEnemy bosseny = new Entities.BossEnemy();
                         bosseny.xmlImport(XMLReader, Content);
                         instance.AddEntity(bosseny);
                         break;
                     case "Obstacle":
                         //Console.WriteLine("Start <Obstacle> element.");
                         Obstacle obs = new Obstacle();
                         obs.xmlImport(XMLReader, Content);
                         instance.AddObject(obs);
                         break;
                 }
             }
         }
         //Console.WriteLine("End <Room> element.");
     }
     return instance;
 }
コード例 #3
0
ファイル: Player.cs プロジェクト: ChocMaltHoney/Neuroleptic
 public void AddPsyche(Items.Psyche p_Psyche)
 {
     if (psCurrentOrb == null)
     {
         psCurrentOrb = new Items.Psyche(p_Psyche);
         //ptOrb = p_Psyche.eType;
         p_Psyche.ToRemove = true;
         //if (lPsycheQueue.Count < iPsycheMax)
         //{
         //    lPsycheQueue.Add(p_Psyche);
         //    p_Psyche.ToRemove = true;
         //    GenerateSpell();
         //}
     }
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: ChocMaltHoney/Neuroleptic
 private void Cast()
 {
     if (psCurrentOrb == null)
         return;
     switch (psCurrentOrb.eType)
     {
         case Items.Psyche.Type.DISPARE: CastDispare(); break;
         case Items.Psyche.Type.HATE: CastHate(); break;
         case Items.Psyche.Type.MISERY: CastMisery(); break;
         case Items.Psyche.Type.TYPE_NULL: break;
     }
     psCurrentOrb = null;
     //ptOrb = Items.Psyche.Type.TYPE_NULL;
     //if (lPsycheQueue.Count < 2)
     //    return;
     //lPsycheQueue.RemoveRange(0, 2);
     ////  TODO: Spell Code
 }
コード例 #5
0
ファイル: Player.cs プロジェクト: ChocMaltHoney/Neuroleptic
        public Player(ContentManager Content, String t2d_Tex = "Entities/Player")
            : base(Content, t2d_Tex)
        {
            fReboundDuration = 200;     //rebound duration after attacking in ms
            bDrawHealth = true;
            bAttacking = false;

            HealthCurrent = HealthMax = 20.0f;
            Speed = 2.0f;

            UFrameMax = 9;
            VFrameMax = 1;
            FrameWidth = Texture.Width / UFrameMax;
            FrameHeight = Texture.Height / VFrameMax;
            base.UpdateIndex();

            wWeapon = Items.Weapon.FistBasic(Content);
            //lPsycheQueue = new List<Items.Psyche>();

            Origin = new Vector2(FrameWidth / 2, FrameHeight / 2);

            Position = new Vector2(200, 200);
            v2FacingDir = new Vector2(1, 0);

            psCurrentOrb = null;// Items.Psyche.Type.HATE;

            //  Spells
            //  Dispare
            bShield = false;
            fShieldDuration = 5.0f;
            peShield = Particle.Emitter.Shield(Content, fShieldDuration);
            //  Hate
            bHeal = false;
            fHealDuration = 1.5f;
            fHealAmount = 5.0f;
            peHeal = Particle.Emitter.Heal(Content, fHealDuration);
            //  Misery
            bInvisible = false;
            fInvisibleDuration = 2.0f;
            fInvisibleAmount = 0.2f;
            peInvisible = Particle.Emitter.Invisible(Content);

            //  Attacking
            fAttackTimer = wWeapon.Cooldown;
            asAttackSprite = new AnimatedSprite(Content, "Entities/AttackSwing");
            asAttackSprite.Scale = 0.2f;
            asAttackSprite.Origin = new Vector2(asAttackSprite.FrameWidth / 2, asAttackSprite.FrameHeight / 2);

            seAttackSwing = Content.Load<SoundEffect>("Entities/Sound/swing04");

            //HUD
            asLeft = new AnimatedSprite(Content, "pixel");
            asLeft.Colour = new Color(Color.Black, 1.0f);
            asLeft.FrameHeight = 32;
            asLeft.FrameWidth = 32;
            asLeft.Alpha = 0.2f;

            asRight = new AnimatedSprite(asLeft);

        }
コード例 #6
0
ファイル: Enemy.cs プロジェクト: ChocMaltHoney/Neuroleptic
        public Enemy(ContentManager Content, int i_ChanceDrop, String t2d_Tex = "image")
            : base(Content, t2d_Tex)
        {
            bAgro = false;
            //fWanderTimer = 0;
            bDrawHealth = true;
            fDamage = 1.0f;
            pOrbDrop = new Items.Psyche(Content);
            Colour = new Color(1.0f, 1.0f, 1.0f);

            Origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
            iChanceDrop = i_ChanceDrop;

            Jitter = new Vector2();
            CircleDist = 60;
            CircleCentre = new Vector2();
            WanderAngle = Control.Rand.Next(0, 259);
            WanderAngleRand = 2;
            WanderForce = new Vector2();

            UFrameMax = 9;
            VFrameMax = 1;
            FrameWidth = Texture.Width / UFrameMax;
            FrameHeight = Texture.Height / VFrameMax;

            Colour = new Color(1.0f, 1.0f, 1.0f);
            Origin = new Vector2(FrameWidth / 2, FrameHeight / 2);

            fAttackDamage = 0.0f;
            fAttackRange = (FrameWidth > FrameHeight) ? FrameWidth : FrameHeight;   //  Which ever is largest
            fAttackTimer = fAttackCooldown = 1000.0f;
            iShootTimer = iShootMax = 1000;
            fLength = 99999999;
            fWanderTimer = 0;
            fWanderCooldown = 400;
            fAnimationMax = 100;

            base.UpdateIndex();
        }
コード例 #7
0
ファイル: Enemy.cs プロジェクト: ChocMaltHoney/Neuroleptic
 public new void xmlImport(XmlReader xml_Reader, ContentManager Content)
 {
     while (xml_Reader.Read())
     {
         String attrib;
         switch (xml_Reader.Name)
         {
             case "Variables":
                 attrib = xml_Reader["AttackCooldown"];
                 if (attrib != null) { fAttackCooldown = float.Parse(attrib); }
                 attrib = xml_Reader["AttackDamage"];
                 if (attrib != null) { fAttackDamage = float.Parse(attrib); }
                 attrib = xml_Reader["AttackRange"];
                 if (attrib != null) { fAttackRange = float.Parse(attrib); }
                 attrib = xml_Reader["WanderCooldown"];
                 if (attrib != null) { fWanderCooldown = float.Parse(attrib); }
                 attrib = xml_Reader["DropChance"];
                 if (attrib != null) { iChanceDrop = int.Parse(attrib); }
                 attrib = xml_Reader["CircleDist"];
                 if (attrib != null) { CircleDist = float.Parse(attrib); }
                 attrib = xml_Reader["WanderAngle"];
                 if (attrib != null) { WanderAngle = float.Parse(attrib); }
                 attrib = xml_Reader["WanderAngleRand"];
                 if (attrib != null) { WanderAngleRand = float.Parse(attrib); }
                 attrib = xml_Reader["StartState"];
                 if (attrib != null) { States = (AIState)int.Parse(attrib); }
                 attrib = xml_Reader["AnimationMax"];
                 if (attrib != null) { fAnimationMax = float.Parse(attrib); }
                 break;
             case "Entity":
                 base.xmlImport(xml_Reader, Content);
                 break;
             case "Enemy":
                 pOrbDrop = new Items.Psyche(Content);
                 return;
         }
     }
 }