예제 #1
0
        public void CreatePin(ActorFacade actorFacade)
        {
            GameObject pinPrefab;

            switch (actorFacade.Actor.Type)
            {
            case Type.Battle.ActorType.Submarine:
                pinPrefab = actorFacade.IsMine ?
                            playerPinPrefab :
                            enemyPinPrefab;
                break;

            case Type.Battle.ActorType.Torpedo:
                pinPrefab = torpedoPinPrefab;
                break;

            case Type.Battle.ActorType.Watcher:
                pinPrefab = watcherPinPrefab;
                break;

            default:
                throw new NotImplementedException("Unsupported actor type: " + actorFacade.Actor.Type);
            }
            var pin = Instantiate(pinPrefab).GetComponent <RectTransform>();

            pin.SetParent(pinContainer, true);
            pinsByActor.Add(actorFacade, pin);
        }
예제 #2
0
 public bool TryDestroyActor(long actorId, out ActorFacade actor)
 {
     if (TryGet(actorId, out actor))
     {
         actors.Remove(actorId);
         actor.Dispose();
         return(true);
     }
     return(false);
 }
예제 #3
0
        public void DestroyPin(ActorFacade actorFacade)
        {
            RectTransform pin;

            if (pinsByActor.TryGetValue(actorFacade, out pin))
            {
                Destroy(pin.gameObject);
                pinsByActor.Remove(actorFacade);
            }
        }
예제 #4
0
 void OnActorDestroy(ActorFacade actorFacade)
 {
     view.DestroyPin(actorFacade);
 }
예제 #5
0
 void OnActorCreate(ActorFacade actorFacade)
 {
     view.CreatePin(actorFacade);
 }
예제 #6
0
 public bool TryGet(long actorId, out ActorFacade actorFacade)
 {
     return(actors.TryGetValue(actorId, out actorFacade));
 }
예제 #7
0
        Quaternion GetRadarRotation(ActorFacade actorFacade)
        {
            var eulerAngles = new Vector3(0f, 0f, actorFacade.View.ActorDirection - 90f);

            return(Quaternion.Euler(eulerAngles));
        }
예제 #8
0
        Vector3 GetRadarPosition(ActorFacade actorFacade)
        {
            var position = actorFacade.View.ActorPosition;

            return(matrixForRadarPosition.MultiplyPoint3x4(new Vector3(position.x, position.y)));
        }