Пример #1
0
        public void CheckTile(Game game, AbstractWorld world)
        {
            //reflektion

            IWorldObject ObjectInTile = null;

            ObjectInTile = world.WorldObjects.Find(wo =>
                                                   wo.Position.X == Position.X && wo.Position.Y == Position.Y);
            string NameOfObjectInTile = ObjectInTile.GetType().Name;

            if (NameOfObjectInTile != "Player")
            {
                switch (NameOfObjectInTile)
                {
                case "Sword":
                    Weapon = ObjectInTile as IWeapon;
                    ObjectInTile.Position = null;
                    world.WorldObjects.Remove(ObjectInTile);
                    break;

                case "Bow":
                    Weapon = ObjectInTile as IWeapon;
                    ObjectInTile.Position = null;
                    world.WorldObjects.Remove(ObjectInTile);
                    break;

                case "Monster":
                    game.CombatOponent = ObjectInTile as ICharacter;
                    game.GameState     = GameState.Combat;
                    break;
                }
                Console.WriteLine(NameOfObjectInTile);
                Console.ReadKey();
            }
        }
 public GameObjectLinkViewModel(IUriService uriService, IWorldObject worldObject)
 {
     Uri         = uriService.GetUri(worldObject);
     DisplayName = worldObject.Name;
     //TODO ugly hack
     Type = worldObject.GetType().IsSubclassOf(typeof(CharacterGroup))
         ? GameObjectLinkType.CharacterGroup
         : GameObjectLinkType.Character;
     IsActive = worldObject.IsActive;
 }
Пример #3
0
 public static GameObjectLinkViewModel AsObjectLink([NotNull] this IWorldObject obj)
 {
     if (obj == null)
     {
         throw new ArgumentNullException(nameof(obj));
     }
     //TODO ugly hack
     return(new GameObjectLinkViewModel()
     {
         DisplayName = obj.Name,
         Identification = obj.Id.ToString(),
         ProjectId = obj.ProjectId,
         LinkType = obj.GetType().IsSubclassOf(typeof(CharacterGroup)) ? LinkType.ResultCharacterGroup : LinkType.ResultCharacter,
         IsActive = obj.IsActive
     });
 }
Пример #4
0
        private void ObjectSpawned(IWorldObject worldObject, double X, double Y, double Z, byte pitch, byte yaw)
        {
            if (token.stopped)
            {
                return;
            }

            // We only care for fishing hook spawns.
            if (worldObject.GetType() != ObjectTypes.FishingHook)
            {
                return;
            }

            var hook = (FishingFloatObject)worldObject;

            if (hook.Owner != player.status.entity.entityId)
            {
                return;             // We care only for our hook.
            }
            this.lureObject = hook; // Assign the lure object.
        }
Пример #5
0
        internal Vector2 LookFor(IWorldObject _objectToLookFor, Vector2 location,int radius)
        {
            foreach (WorldObjectContainer obj in this._worldObjectsList)
            {
                if (obj.ContainedObject.GetType() ==  _objectToLookFor.GetType())
                {
                    if (obj.Position.X > location.X - radius && obj.Position.X < location.X + radius)
                    {
                        if (obj.Position.Y > location.Y - radius && obj.Position.Y < location.Y + radius)
                        {
                            return obj.Position;
                        }
                    }
                }
            }

            return Vector2.Zero;
        }