예제 #1
0
 public void OnToggleChange(bool isOn)
 {
     if (isOn)
     {
         Autopilot.ChadburnSetting chad = GetChadburnByToggle(toggleGroup.GetFirstActiveToggle());
         if (P2PManager.IsMPActive())
         {
             P2PManager.Inst.Send(new MTShipChadburn {
                 PlayerTag = GameManager.ThisPlayerTag, ShipID = InputManager.SelectedShip.ID, ChadburnSetting = chad
             });
         }
         InputManager.SelectedShip.Autopilot.Chadburn = chad;
     }
 }
예제 #2
0
        public void OnScroll(PointerEventData eventData)
        {
            compassNeedleImg.rectTransform.Rotate(0f, 0f, -eventData.scrollDelta.y, Space.Self);
            ushort course = (ushort)(360 - Mathf.RoundToInt(compassNeedleImg.rectTransform.localRotation.eulerAngles.z));

            if (P2PManager.IsMPActive())
            {
                P2PManager.Inst.Send(new MTShipCourse {
                    PlayerTag = GameManager.ThisPlayerTag, ShipID = InputManager.SelectedShip.ID, Course = course
                });
            }
            InputManager.SelectedShip.Autopilot.Course = course;
            eventData.Use();
        }
예제 #3
0
    private void Start()
    {
        fleets.ForEach(f => f.Ships.ForEach(s => {
            s.OnSinking += ShipSinkingHandler;
        }));

        if (P2PManager.IsMPActive())
        {
            // Stop game until all players are loaded
            Time.timeScale = 0f;
            MessageHandler.Inst.OnReceivedGameReady += ReceiveGameReadyHandler;
            StartCoroutine(WaitForPeerGameReady());
        }
    }
예제 #4
0
 private void TargetShip(Ship ship)
 {
     if (P2PManager.IsMPActive())
     {
         if (ship == null)
         {
             P2PManager.Inst.Send(new MTShipTarget {
                 PlayerTag = GameManager.ThisPlayerTag, ShipID = selectedShip.ID, HasTarget = false
             });
         }
         else
         {
             P2PManager.Inst.Send(new MTShipTarget {
                 PlayerTag = GameManager.ThisPlayerTag, ShipID = selectedShip.ID, HasTarget = true, TargetShipID = ship.ID
             });
         }
     }
     selectedShip.Targeting.Target = ship;
     GameUI.Inst.SetCurrShipTarget(ship); // Currently only ship targets are supported!
 }