Ejemplo n.º 1
0
 public void Setup()
 {
     gameFlowController    = FindObjectOfType <GameflowController> ();
     orientationController = FindObjectOfType <OrientationController> ();
     buildingController    = FindObjectOfType <BuildingController> ();
     inGameDBController    = FindObjectOfType <InGameDBController> ();
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            orientationController = new AndroidAccelOrientationManager(this);
            if (Application.loadedLevel == 4) {
                positionController = new GPSPositionController(this);
            }
            Debug.Log("Using android orientation");
        }
        else
        {
            Debug.Log("Using PC orientation");
            orientationController = new MouseOrientationController(this);
            positionController = new KeyboardPositionController(this);
        }

        if(orientationController != null)
        {
            orientationController.Start();
        }

        if(positionController != null)
        {
            positionController.Start();
        }
    }
Ejemplo n.º 3
0
 private void OnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     if (propertyChangedEventArgs.PropertyName.Equals(nameof(OrientationController)) && !isOnDisappearingContext)
     {
         //save the new controller
         savedControllerState = OrientationController;
     }
 }
Ejemplo n.º 4
0
 public OrientationViewController(OrientationController controller, UIViewController[] childs)
 {
     this.controller = controller;
     foreach (UIViewController uiViewController in childs)
     {
         AddChildViewController(uiViewController);
         View.AddSubview(uiViewController.View);
     }
 }
Ejemplo n.º 5
0
        public ExhibitDetailsPage()
        {
            InitializeComponent();

            // Workaround because OnDisappearing is called when the app starts sleeping(on Android) and the OrientationController is reset. Therefore, we need to safe the controller and reapply it after the app wakes up.
            savedControllerState = OrientationController;
            PropertyChanged     += OnPropertyChanged;
            MessagingCenter.Subscribe <App>(this, AppSharedData.WillWakeUpMessage, WillWakeUp);
        }
Ejemplo n.º 6
0
 void Start()
 {
     touchesOld            = new List <GameObject>();
     gameFlowController    = FindObjectOfType <GameflowController>();
     inGameDBController    = FindObjectOfType <InGameDBController> ();
     tileController        = FindObjectOfType <TileController> ();
     orientationController = FindObjectOfType <OrientationController> ();
     taskController        = FindObjectOfType <TaskController> ();
 }
Ejemplo n.º 7
0
        // ---- UTILITIES ----

        protected virtual void LoadControllers()
        {
            // Load all utilities here

            OrientationController.Load(this);
            EquipmentSlots.Load(this);

            Render          = GetComponentInChildren <EntityRenderer>();
            FlippableSprite = GetComponentInChildren <FlippableSprite>();
        }
Ejemplo n.º 8
0
 public DroneSimulator()
 {
     this.pwmController         = new SimulationPwmController();
     this.orientationSensor     = new SimulationOrientationSensor();
     this.motorController       = new MotorController(this.pwmController);
     this.orientationController = new OrientationController(this.motorController, this.orientationSensor, new Dictionary <Axis, IOrientationOffsetHandler>()
     {
         [Axis.Yaw]   = new QLearningOrientationOffsetHandler(-180, 180, 1, -.05f, .05f, .01f),
         [Axis.Pitch] = new QLearningOrientationOffsetHandler(-180, 180, 1, -.05f, .05f, .01f),
         [Axis.Roll]  = new QLearningOrientationOffsetHandler(-180, 180, 1, -.05f, .05f, .01f),
     });
     this.outputQueue = new ConcurrentQueue <Vector3>();
 }
Ejemplo n.º 9
0
    void Start()
    {
        introHolder    = FindObjectOfType <StartGameID> ();
        tileController = FindObjectOfType <TileController>();
        tileController.Setup();
        buildingController = FindObjectOfType <BuildingController> ();
        buildingController.Setup();
        inGameDBController    = FindObjectOfType <InGameDBController>();
        orientationController = FindObjectOfType <OrientationController>();
        taskController        = FindObjectOfType <TaskController>();
        taskController.Setup();
        inGameDBController.StartConnection();
        inGameDBController.FetchInitialGridData();
        tileController.CreateGrid(inGameDBController.GetGridSize());
        inGameDBController.FetchBuildingData();
        buildingController.CreateBuildings(inGameDBController.GetBuildingData());
        inGameDBController.SetGameID(introHolder.GetRoomID());
        inGameDBController.InsertRoomData(introHolder.GetTurnID(), introHolder.getIGNList(), introHolder.getPIDList());
        inGameDBController.FetchCurrentPlayerTurn();
        localPlayerPID    = introHolder.GetPID();
        localPlayerTurnID = introHolder.GetTurnID();
        //GameObject.Destroy (introHolder);

        players = new List <Player>();
        Debug.Log(inGameDBController.GetNumberOfPlayers());
        CreatePlayers(inGameDBController.GetNumberOfPlayers());
        inGameDBController.FetchTaskData();
        taskController.AssignBuildingTasks(inGameDBController.GetTaskData(), buildingController.GetBuildings());
        taskController.AssignLocalPlayerTasks(inGameDBController.GetTaskData(), GetLocalPlayer());
        taskController.InitializeLPTaskLabels(GetLocalPlayer().tasks);

        orientationController.ScaleUI();
        tileController.SetLocalPlayerModelRef(players[localPlayerTurnID].playerModel);

        SetInitialCameraPosition();
        remainingMoves = 0;
        turnHasBegun   = false;
        orientationController.SetMovesLabel("Wait Your Turn");
        orientationController.SetRollDiceButtonStatus(false);
        orientationController.SetEnterBuildingButtonStatus(false);
        orientationController.SetEndTurnButtonStatus(false);
        tileController.SetCanLightUpTile(false);

        if (GetIsLocalPlayerTurn())
        {
            BeginTurn();
        }

        timer = 0;
    }
 private void SetOrientationController(OrientationController controller)
 {
     if (controller == OrientationController.LandscapeConstant)
     {
         ((Activity)Context).RequestedOrientation = ScreenOrientation.Landscape;
     }
     else if (controller == OrientationController.PortraitConstant)
     {
         ((Activity)Context).RequestedOrientation = ScreenOrientation.Portrait;
     }
     else
     {
         ((Activity)Context).RequestedOrientation = ScreenOrientation.Sensor;
     }
 }
Ejemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            orientationController = new AndroidAccelOrientationManager(this);
            positionController    = new GPSPositionController(this);
        }
        else
        {
            orientationController = new MouseOrientationController(this);
            positionController    = new KeyboardPositionController(this);
        }

        if (orientationController != null)
        {
            orientationController.Start();
        }

        if (positionController != null)
        {
            positionController.Start();
        }
    }
 private void SetController(OrientationController controller)
 {
     if (controller == OrientationController.Sensor)
     {
         // restore the normal controler whioch supports rotation
         foreach (UIViewController viewController in UIApplication.SharedApplication.KeyWindow.RootViewController.ChildViewControllers)
         {
             normalController.AddChildViewController(viewController);
             normalController.View.Add(viewController.View);
         }
         UIApplication.SharedApplication.KeyWindow.RootViewController = normalController;
     }
     else
     {
         if (controller == OrientationController.PortraitConstant)
         {
             UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.Portrait), new NSString("orientation"));
         }
         // disable rotation
         UIApplication.SharedApplication.KeyWindow.RootViewController = new OrientationViewController(controller,
                                                                                                      UIApplication.SharedApplication.KeyWindow.RootViewController
                                                                                                      .ChildViewControllers);
     }
 }
Ejemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     controller = new OrientationController("COM4");
 }
Ejemplo n.º 14
0
 // }
 // *******************
 void Start()
 {
     transform.GetComponent<Orientation>().StateChange += ModuleStateChangeListener;
     orientationController = gameObject.GetComponent<OrientationController>();
     Color lineColor = Color.white;
     float lineWidth = 1.0f;
     float capLength = 0.0f;
     int lineDepth = 0;
     LineType lineType = LineType.Discrete;
     Joins joins = Joins.None;
     linePoints[0] = Vector3.zero;
     gridPoints[0] = Vector3.zero;
     VectorLine.SetLineParameters(lineColor, lineMaterial, lineWidth, capLength, lineDepth, lineType, joins);
     headingIndicator = VectorLine.MakeLine (transform.parent.name + "HeadingLine", linePoints, Color.green);
     orientationGridLine = VectorLine.MakeLine (transform.parent.name + "OrientationGrid", gridPoints);
 }
Ejemplo n.º 15
0
    // void Start() { Init(); }
    // void OnEnable() { Init(); }
    public void Start()
    {
        Debug.Log("Initializing " + transform.name);
        ship = gameObject.GetComponent<Ship>();
        shipView = gameObject.GetComponent<ShipView>();
        modules = ship.modules;
        actionQueue = ship.actionQueue;
        // This should probably not exist;
        orientationController = transform.Find("Orientation").GetComponent<OrientationController>();
        shipView.enabled = false;
        ship.runQueue = false;
        foreach (Transform child in transform) if (child.CompareTag("Module")) {
            Debug.Log("Adding " + child.name);
            ModuleInterface controller = child.gameObject.GetComponent(typeof(ModuleInterface)) as ModuleInterface;
          ship.modules.Add(child.name, controller);
        }

        // foreach (Transform child in transform) if (child.name == "ShipMesh") {
        //   Debug.Log("Testing " + child.name);
        //   mesh = child.gameObject.GetComponent(typeof(MeshInterface)) as MeshInterface;
        // }
    }