예제 #1
0
        WatcherFacade CreateWatcher(Type.Battle.Actor actor)
        {
            var watcher = watcherFactory.Create(actor);

            actors.Add(actor.Id, watcher);
            return(watcher);
        }
예제 #2
0
        TorpedoFacade CreateTorpedo(Type.Battle.Actor actor)
        {
            var torpedo = torpedoFactory.Create(actor);

            actors.Add(actor.Id, torpedo);
            return(torpedo);
        }
예제 #3
0
        SubmarineFacade CreateSubmarine(Type.Battle.Actor actor)
        {
            var isPlayerSubmarine = actor.UserId == userModel.LoggedInUser.Value.Id;
            var submarine         = submarineFactory.Create(actor, isPlayerSubmarine);

            actors.Add(actor.Id, submarine);
            return(submarine);
        }
예제 #4
0
        void OnActorRemove(Type.Battle.Actor actor)
        {
            ActorFacade actorFacade;

            if (actorContainer.TryDestroyActor(actor.Id, out actorFacade))
            {
                actorDestroyEvent.Invoke(actorFacade);
            }
        }
예제 #5
0
        public ActorFacade CreateActor(Type.Battle.Actor actor)
        {
            switch (actor.Type)
            {
            case Type.Battle.ActorType.Submarine:
                return(CreateSubmarine(actor));

            case Type.Battle.ActorType.Torpedo:
                return(CreateTorpedo(actor));

            case Type.Battle.ActorType.Watcher:
                return(CreateWatcher(actor));

            default:
                throw new NotImplementedException("Unsupported actor type: " + actor.Type);
            }
        }
예제 #6
0
        void OnActorAdd(Type.Battle.Actor actor)
        {
            var actorFacade = actorContainer.CreateActor(actor);

            actorCreateEvent.Invoke(actorFacade);
        }
예제 #7
0
 public ActorMotor(IClock clock, Type.Battle.Actor actor)
 {
     this.clock = clock;
     SetMovement(actor.Movement);
 }
예제 #8
0
 public void SendActor(TyphenApi.Type.Submarine.Battle.Actor actor)
 {
     session.Send((int)MessageType.Actor, actor);
 }