Exemplo n.º 1
0
 public override void handleWalkUpCommand(LivingObject actor)
 {
     if (!actor.MoveUp)
     {
         actor.MoveUp = true;
         Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.PlayerCommandMessage(actor as PlayerObject, ECommandType.WalkTopCommand), GameMessageImportance.VeryImportant);
     }
 }
Exemplo n.º 2
0
 public override void stopWalkRightCommand(LivingObject actor)
 {
     if (actor.MoveRight)
     {
         actor.MoveRight = false;
         Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.PlayerCommandMessage(actor as PlayerObject, ECommandType.StopWalkRightCommand), GameMessageImportance.VeryImportant);
     }
 }
Exemplo n.º 3
0
 public void attackLivingObject(LivingObject _Target, int _Damage)
 {
     if(Configuration.Configuration.isHost)
         _Target.onAttacked(this, _Damage);
 }
Exemplo n.º 4
0
 public WalkLeftCommand(LivingObject _walkActor)
 {
     this.walkActor = _walkActor;
 }
Exemplo n.º 5
0
        // LIVINGOBJEKT
        public void draw(GraphicsDevice _GraphicsDevice, SpriteBatch _SpriteBatch, LivingObject _Target)
        {
            if (Setting.Setting.drawWorld)
            {
                if (_Target != null)
                {
                    if (_Target.CurrentBlock != null)
                    {
                        int var_DrawSizeX = Setting.Setting.blockDrawRange;
                        int var_DrawSizeY = Setting.Setting.blockDrawRange;

                        List<Object.Object> var_PreEnviornmentObjectsToDraw = new List<Object.Object>();
                        List<Object.Object> var_ObjectsToDraw = new List<Object.Object>();

                        for (int x = 0; x < var_DrawSizeX; x++)
                        {
                            for (int y = 0; y < var_DrawSizeY; y++)
                            {
                                Vector3 var_Position = new Vector3(_Target.CurrentBlock.Position.X + (-var_DrawSizeX / 2 + x) * Block.Block.BlockSize, _Target.CurrentBlock.Position.Y + (-var_DrawSizeY / 2 + y) * Block.Block.BlockSize, 0);
                                if(var_Position.X>0 && var_Position.Y > 0)
                                {

                                }
                                Block.Block var_Block = this.getBlockAtCoordinate(var_Position);
                                if (var_Block != null)
                                {
                                    if (var_Block.IsRequested)
                                    {
                                    }
                                    else
                                    {
                                        if (Setting.Setting.drawBlocks)
                                        {
                                            var_Block.drawBlock(_GraphicsDevice, _SpriteBatch);
                                        }
                                        var_PreEnviornmentObjectsToDraw.AddRange(var_Block.ObjectsPreEnviorment);
                                        var_ObjectsToDraw.AddRange(var_Block.Objects);
                                    }
                                }
                                else
                                {
                                    /*Region.Region var_Region = this.getRegionAtPosition(var_Position.X, var_Position.Y);
                                    if (var_Region == null)
                                    {
                                    }
                                    else
                                    {
                                        Chunk.Chunk var_Chunk = this.getChunkAtPosition(var_Position.X, var_Position.Y);
                                        if (var_Chunk == null)
                                        {
                                            Vector2 var_PositionChunk = Chunk.Chunk.parsePosition(var_Position);
                                            var_Chunk = new Chunk.Chunk("", (int)var_PositionChunk.X, (int)var_PositionChunk.Y, null);
                                            var_Chunk.IsRequested = true;
                                            var_Region.setChunkAtPosition((int)var_PositionChunk.X, (int)var_PositionChunk.Y, var_Chunk);
                                            Event.EventList.Add(new Event(new RequestChunkMessage(var_PositionChunk), GameMessageImportance.VeryImportant));
                                        }
                                        else
                                        {
                                            if (var_Chunk.IsRequested)
                                            {
                                            }
                                            else
                                            {
                                                var_Block = new Block.Block((int)var_Position.X, (int)var_Position.Y, Block.BlockEnum.Nothing, var_Chunk);
                                                var_Block.IsRequested = true;
                                                var_Chunk.setBlockAtCoordinate(var_Position, var_Block);
                                                //var_Block.requestFromServer(var_Position);
                                                Event.EventList.Add(new Event(new RequestBlockMessage(var_Position), GameMessageImportance.VeryImportant));
                                            }
                                        }
                                    }*/
                                }
                            }
                        }
                        if (Setting.Setting.drawPreEnvironmentObjects)
                        {
                            var_PreEnviornmentObjectsToDraw.Sort(new Ressourcen.ObjectPositionComparer());
                            foreach (AnimatedObject var_AnimatedObject in var_PreEnviornmentObjectsToDraw)
                            {
                                var_AnimatedObject.draw(_GraphicsDevice, _SpriteBatch, Vector3.Zero, Color.White);
                            }
                        }
                        if (Setting.Setting.drawObjects)
                        {
                            var_ObjectsToDraw.Sort(new Ressourcen.ObjectPositionComparer());
                            foreach (AnimatedObject var_AnimatedObject in var_ObjectsToDraw)
                            {
                                var_AnimatedObject.draw(_GraphicsDevice, _SpriteBatch, Vector3.Zero, Color.White);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
 public abstract void handleWalkUpCommand(LivingObject actor);
Exemplo n.º 7
0
 public abstract void stopWalkUpCommand(LivingObject actor);
Exemplo n.º 8
0
 public override void handleWalkRightCommand(LivingObject actor)
 {
     actor.MoveRight = true;
 }
Exemplo n.º 9
0
 public abstract void handleAttackCommand(LivingObject actor);
Exemplo n.º 10
0
 public override void handleAttackCommand(LivingObject actor)
 {
     actor.attack();//actor.attackLivingObject(null, 0); //TODO: Noch Response einbauen, dass Attackanimation nur dann gestartet wird, wenn ein Objekt getroffen wurde
     Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.PlayerCommandMessage(actor as PlayerObject, ECommandType.AttackCommand), GameMessageImportance.VeryImportant);
 }
Exemplo n.º 11
0
        /*public void moveOnPath(LivingObject _LivingObject)
        {
            if (!this.finished && this.pathNodes != null)
            {
                if (this.currentNode == null)
                {
                    this.currentNode = this.extractFirst();
                }

                if (this.currentNode != null)
                {
                    PathNode var_NextNode = this.getNextNode();
                    if (var_NextNode != null)
                    {
                        if (this.isInRange(new Vector2(_LivingObject.Position.X, _LivingObject.Position.Y), new Vector2(var_NextNode.block.Position.X+16,var_NextNode.block.Position.Y+16), 5))
                        {
                            this.currentNode = this.extractFirst();
                            var_NextNode = this.getNextNode();
                        }

                        if (var_NextNode != null)
                        {
                            _LivingObject.MoveRight = false;
                            _LivingObject.MoveLeft = false;
                            _LivingObject.MoveDown = false;
                            _LivingObject.MoveUp = false;
                            if (var_NextNode.block.Position.X > this.currentNode.block.Position.X)
                            {
                                _LivingObject.MoveRight = true;
                            }
                            else if (var_NextNode.block.Position.X < this.currentNode.block.Position.X)
                            {
                                _LivingObject.MoveLeft = true;
                            }
                            if (var_NextNode.block.Position.Y > this.currentNode.block.Position.Y)
                            {
                                _LivingObject.MoveDown = true;
                            }
                            else if (var_NextNode.block.Position.Y < this.currentNode.block.Position.Y)
                            {
                                _LivingObject.MoveUp = true;
                            }
                        }
                        else
                        {
                            this.finished = true;
                        }
                    }
                }
                if (this.currentNode == null)
                {
                    this.finished = true;
                }
            }
        }*/
        public void moveOnPath(LivingObject _LivingObject)
        {
            if (!this.finished && this.pathNodes != null)
            {
                if (_LivingObject.CurrentBlock != null)
                {
                    PathNode var_NextNode = this.getNextNode();
                    if (var_NextNode != null)
                    {
                        if (this.isInRange(new Vector2(_LivingObject.Position.X, _LivingObject.Position.Y), new Vector2(var_NextNode.block.Position.X + 16, var_NextNode.block.Position.Y + 16), (int)_LivingObject.MovementSpeed*15))
                        {
                            var_NextNode = this.extractFirst();
                        }

                        if (var_NextNode != null)
                        {
                            _LivingObject.MoveRight = false;
                            _LivingObject.MoveLeft = false;
                            _LivingObject.MoveDown = false;
                            _LivingObject.MoveUp = false;
                            if (var_NextNode.block.Position.X + 16  > _LivingObject.Position.X)
                            {
                                _LivingObject.MoveRight = true;
                            }
                            else if (var_NextNode.block.Position.X + 16 < _LivingObject.Position.X)
                            {
                                _LivingObject.MoveLeft = true;
                            }
                            if (var_NextNode.block.Position.Y + 16 > _LivingObject.Position.Y)
                            {
                                _LivingObject.MoveDown = true;
                            }
                            else if (var_NextNode.block.Position.Y + 16 < _LivingObject.Position.Y)
                            {
                                _LivingObject.MoveUp = true;
                            }
                        }
                        else
                        {
                            this.finished = true;
                        }
                    }
                    else
                    {
                        this.finished = true;
                    }
                }
            }
        }
Exemplo n.º 12
0
 public override void stopWalkRightCommand(LivingObject actor)
 {
     actor.MoveRight = false;
 }
Exemplo n.º 13
0
 public override void stopWalkUpCommand(LivingObject actor)
 {
     actor.MoveUp = false;
 }
Exemplo n.º 14
0
 public override void stopWalkLeftCommand(LivingObject actor)
 {
     actor.MoveLeft = false;
 }
Exemplo n.º 15
0
 public override void stopWalkDownCommand(LivingObject actor)
 {
     actor.MoveDown = false;
 }
Exemplo n.º 16
0
 public override void handleWalkUpCommand(LivingObject actor)
 {
     actor.MoveUp = true;
 }
Exemplo n.º 17
0
 public void getInteracted(LivingObject _Interactor)
 {
     foreach (LivingObjectInteraction var_Interaction in this.interactions)
     {
         var_Interaction.doInteraction(_Interactor);
     }
 }
Exemplo n.º 18
0
 public override void handleWalkDownCommand(LivingObject actor)
 {
     actor.MoveDown = true;
 }
Exemplo n.º 19
0
        public virtual void onAttacked(LivingObject _Attacker, int _DamageAmount)
        {
            this.damage(_DamageAmount);
            this.aggroSystem.addAggro(_Attacker, _DamageAmount * 100f);
            Vector3 knockBackVector = this.Position - _Attacker.Position;
            knockBackVector.X = knockBackVector.X / knockBackVector.Length() * 20;
            knockBackVector.Y = knockBackVector.Y / knockBackVector.Length() * 20;
            knockBackVector.Z = knockBackVector.Z / knockBackVector.Length() * 20;
            //this.knockBack(knockBackVector);

            Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.UpdateObjectPositionMessage(this), GameMessageImportance.VeryImportant);
            Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.UpdateObjectHealthMessage(this), GameMessageImportance.VeryImportant);

            this.checkChangedBlock();
        }
Exemplo n.º 20
0
 public override void handleWalkLeftCommand(LivingObject actor)
 {
     actor.MoveLeft = true;
 }
Exemplo n.º 21
0
 public AttackCommand(LivingObject _walkActor)
 {
     this.walkActor = _walkActor;
 }
Exemplo n.º 22
0
 public override void handleAttackCommand(LivingObject actor)
 {
     if (actor is CreatureObject)
         (actor as CreatureObject).attack();
 }