示例#1
0
        public override void Update(Character[] c, int id, Map map)
        {
            Me = c[id];
            if (JobFrame < 0f)
            {
                var r = Rand.GetRandomFloat(0f, 1f);
                if (r < 0.6f)
                {
                    Job = JobMeleeChase;
                    JobFrame = Rand.GetRandomFloat(2f, 4f);
                    Targ = FindTarg(c);
                }
                else if (r < 0.8f)
                {
                    Job = JobAvoid;
                    JobFrame = Rand.GetRandomFloat(1f, 2f);
                    Targ = FindTarg(c);
                }
                else
                {
                    Job = JobIdle;
                    JobFrame = Rand.GetRandomFloat(.5f, 1f);
                }
            }

            base.Update(c, id, map);
        }
示例#2
0
 public virtual void Update(float gameTime, Map map, ParticleManager pMan, Character[] c)
 {
     Location += Trajectory*gameTime;
     Frame -= gameTime;
     if (Frame < 0)
         KillMe();
 }
示例#3
0
        public Bucket(int size, Map map)
        {
            bucketItem = new BucketItem[64];
            Size = size;
            _map = map;

            for (var i = 0; i < bucketItem.Length; i++)
                bucketItem[i] = null;
        }
示例#4
0
 public Hud(SpriteBatch sprite, Texture2D spritesTex, Texture2D nullTex, Character[] character, Map map)
 {
     _sprite = sprite;
     _spritesTex = spritesTex;
     _character = character;
     _map = map;
     _nullTex = nullTex;
     _scoreDraw = new ScoreDraw(_sprite, _spritesTex);
 }
示例#5
0
        public override void Update(float gameTime, Map map, ParticleManager pMan, Character[] c)
        {
            if (Frame < 0.5f)
            {
                if (Trajectory.Y < -10) Trajectory.Y += gameTime * 500;
                if (Trajectory.X < -10) Trajectory.X += gameTime * 150;
                if (Trajectory.X > 10) Trajectory.X -= gameTime * 150;
            }

            base.Update(gameTime, map, pMan, c);
        }
示例#6
0
        public override void Update(float gameTime, Map map, ParticleManager pMan, Character[] c)
        {
            Trajectory.Y += gameTime * 100f;

            if (Trajectory.X < -10f) Trajectory.X += gameTime * 200f;
            if (Trajectory.X > 10f) Trajectory.X -= gameTime * 200f;

            Rotation = GlobalFunctions.GetAngle(Vector2.Zero, Trajectory);

            base.Update(gameTime, map, pMan, c);
        }
示例#7
0
        public override void Update(float gameTime, Map map, ParticleManager pMan, Character[] c)
        {
            if (HitManager.CheckHit(this, c, pMan))
                Frame = 0f;

            if (map.CheckParticleCol(Location))
            {
                Frame = 0f;
                pMan.MakeBulletDust(Location, Trajectory);
            }
            base.Update(gameTime, map, pMan, c);
        }
示例#8
0
 public virtual void Update(Character[] c, int id, Map map)
 {
     Me = c[id];
     Me.KeyLeft = false;
     Me.KeyRight = false;
     Me.KeyUp = false;
     Me.KeyDown = false;
     Me.KeyAttack = false;
     Me.KeySecondary = false;
     Me.KeyJump = false;
     JobFrame -= Game1.FrameTime;
     DoJob(c, id);
 }
示例#9
0
 public MapScript(Map map)
 {
     _map = map;
     Flags = new MapFlags(32);
     Lines = new MapScriptLine[128];
 }
示例#10
0
 public override void Update(float gameTime, Map map, ParticleManager pMan, Character[] c)
 {
     HitManager.CheckHit(this, c, pMan);
     KillMe();
 }
        public void UpdateParticles(float frameTime, Map map, Character[] c)
        {
            for (var i = 0; i < _particles.Length; i++)
            {
                var particle = _particles[i];
                if (particle == null) continue;

                particle.Update(frameTime, map, this, c);
                if (!particle.Exists)
                    _particles[i] = null;
            }
        }
示例#12
0
        protected override void Initialize()
        {
            _map = new Map("start");

            CharDefs[(int)CharacterType.Guy] = new CharDef("chars/guy");
            CharDefs[(int)CharacterType.Zombie] = new CharDef("chars/zombie");

            _characters[0] = new Character(new Vector2(100, 100), CharDefs[(int)CharacterType.Guy], 0,
                Character.TeamGoodGuys) { Map = _map };

            _screenSize.X = GraphicsDevice.Viewport.Width;
            _screenSize.Y = GraphicsDevice.Viewport.Height;

            base.Initialize();

            _particleManager = new ParticleManager(_spriteBatch);
        }