void Start()
 {
     if (bc == null) {
         bc = BattleController.instance;
     }
     this.tForm = transform;
     this.sControl = GetComponent<ShipControlPC>();
     if (sControl == null) {
         this.sControl = GetComponent<EnemyShipControl>();
         if (sControl == null) {
             this.sControl = GetComponent<ShipControlTouch>();//TODO: touch control
             if (sControl == null) {
                 this.sControl = GetComponent<EnemyBossControl>();
             }
         }
     }
     sControl.initialize(this);
     if (gameObject.tag == "Player") {
         player = this;
         this.cropShipPosition = true;
         tForm.position = BattleController.CropShipPosition(tForm.position, shipSize);
     } else {
         this.cropShipPosition = false;
     }
 }
示例#2
0
        public ShipControlPesenter(IShipControl view, ShipViewModel model, IShipService shipService, IScale myScale, IPrinter myPrinter)
        {
            _view        = view;
            _model       = model;
            _shipService = shipService;
            _scale       = myScale;
            _printer     = myPrinter;
            _view.BindToViewModel(model);
            _view.SubmitIdInventoryButtonPressed      += ShipControl_SubmitIdInventoryButtonPressed;
            _view.SubmitWeightButtonPressed           += ShipControl_SubmitWeightButtonPressed;
            _view.CancelButtonPressed                 += ShipControl_CancelButtonPressed;
            _view.GoToCustomizeScalePageButtonPressed += ShipControl_GoToCustomizeScalePageButtonPressed;

            UpdateState(ShipStates.WaitingForIdInventory);
        }
示例#3
0
    public override void OnSpawn()
    {
        base.OnSpawn();

        Vector3 minPosition = Camera.main.ViewportToWorldPoint(new Vector3(0.0f, 0.0f, 0.0f));
        Vector3 maxPosition = Camera.main.ViewportToWorldPoint(new Vector3(1.0f, 1.0f, 0.0f));
        Vector3 sizeVector  = maxPosition - minPosition;

        gameArea = new Rect(minPosition.x, minPosition.y, sizeVector.x, sizeVector.y);

#if UNITY_ANDROID
        this.shipControl = new TouchShipControl();
#else
        if (GamePlayerPrefs.IsMouseControlEnabled)
        {
            this.shipControl = new MouseShipControl();
        }
        else
        {
            this.shipControl = new KeyboardShipControl();
        }
#endif
    }