예제 #1
0
 public virtual void Step()
 {
     if (_job != null)
     {
         _job.Step();
     }
     else
     {
         _status = Constants.Entities.Status.Idle;
     }
 }
예제 #2
0
            public EntityUpdate(byte[] fromByteArray)
            {
                var reader = new BinaryReader(new MemoryStream(fromByteArray));

                // read basic
                unitIndex = reader.ReadInt32();
                unitType  = reader.ReadByte();
                hidden    = reader.ReadBoolean();
                dead      = reader.ReadBoolean();
                status    = (Constants.Entities.Status)reader.ReadByte();

                // read movement
                position  = new ByteVector2(reader.ReadByte(), reader.ReadByte());
                moveSpeed = reader.ReadDouble();

                // read combat
                health         = reader.ReadInt32();
                healthCapacity = reader.ReadInt32();

                attackTarget = new ByteVector2(reader.ReadByte(), reader.ReadByte());
                attacking    = reader.ReadBoolean();
                attackDamage = reader.ReadInt32();
                attackRange  = reader.ReadByte();

                // read inventory
                carryCapacity = reader.ReadByte();
                int carried = reader.ReadByte();

                inventory = new List <byte>();
                for (int i = 0; i < carried; i++)
                {
                    inventory.Add(reader.ReadByte());
                }

                reader.Dispose();
            }