コード例 #1
0
ファイル: MapService.cs プロジェクト: uebari/TeraEmulatorDev
        public void SpawnTeraObject(TeraObject obj, MapInstance instance)
        {
            var creature = obj as Creature;
            if (creature != null)
            {
                lock (instance.CreaturesLock)
                {
                    if (obj is Npc)
                        instance.Npcs.Add((Npc) obj);
                    else if (obj is Player)
                        instance.Players.Add((Player) obj);
                    else if (obj is Campfire)
                        instance.Campfires.Add((Campfire) obj);
                    else if (obj is Gather)
                        instance.Gathers.Add((Gather) obj);
                    else if (obj is Item)
                        instance.Items.Add((Item) obj);
                    else if (obj is Projectile)
                        instance.Projectiles.Add((Projectile) obj);
                }

                creature.Instance = instance;
            }
        }
コード例 #2
0
ファイル: MapService.cs プロジェクト: uebari/TeraEmulatorDev
        public void DespawnTeraObject(TeraObject obj)
        {
            var creature = obj as Creature;
            if (creature != null)
            {
                lock (creature.Instance.CreaturesLock)
                {
                    if (creature is Npc)
                    {
                        creature.Instance.Npcs.Remove((Npc) obj);
                        creature.VisiblePlayers.Each(player =>
                                                         {
                                                             player.VisibleNpcs.Remove((Npc) obj);
                                                             PlayerLogic.OutOfVision(player, creature);
                                                         });
                    }
                    else if (creature is Player)
                    {
                        creature.Instance.Players.Remove((Player) obj);
                        creature.VisiblePlayers.Each(player =>
                                                         {
                                                             player.VisiblePlayers.Remove((Player) obj);
                                                             PlayerLogic.OutOfVision(player, creature);
                                                         });
                    }
                    else if (creature is Campfire)
                    {
                        creature.Instance.Campfires.Remove((Campfire) obj);
                        creature.VisiblePlayers.Each(player =>
                                                         {
                                                             player.VisibleCampfires.Remove((Campfire) obj);
                                                             PlayerLogic.OutOfVision(player, creature);
                                                         });
                    }
                    else if (creature is Gather)
                    {
                        creature.Instance.Gathers.Remove((Gather) obj);
                        creature.VisiblePlayers.Each(player =>
                                                         {
                                                             player.VisibleGathers.Remove((Gather) obj);
                                                             PlayerLogic.OutOfVision(player, creature);
                                                         });
                    }
                    else if (creature is Item)
                    {
                        creature.Instance.Items.Remove((Item) obj);
                        creature.VisiblePlayers.Each(player =>
                                                         {
                                                             player.VisibleItems.Remove((Item) obj);
                                                             PlayerLogic.OutOfVision(player, creature);
                                                         });
                    }
                    else if (creature is Projectile)
                    {
                        creature.Instance.Projectiles.Remove((Projectile) obj);
                        creature.VisiblePlayers.Each(player =>
                                                         {
                                                             player.VisibleProjectiles.Remove((Projectile) obj);
                                                             PlayerLogic.OutOfVision(player, creature);
                                                         });
                    }
                }

                if (!(creature is Player))
                    creature.Release();
            }
        }
コード例 #3
0
 public void StartDialog(Player player, TeraObject o)
 {
     //todo previous controller check
     Npc npc = o as Npc;
     if (npc != null)
         Global.ControllerService.SetController(player, new DialogController(player, npc));
 }
コード例 #4
0
 public static void ShowDialog(Player player, TeraObject o)
 {
     PlayerService.StartDialog(player, o);
 }
コード例 #5
0
 public void PlayerStartDialog(Player player, TeraObject o)
 {
     if (o is Npc)
         SetController(player, new DialogController(player, (Npc)o));
 }