Esempio n. 1
0
 public Player() : base(Constants.Player.Foreground, Color.Transparent, Constants.Player.Character, 1, 1)
 {
     FieldOfViewRadius  = 0;
     InteractionStatus  = false;
     _interaction       = UserInterfaceManager.Get <InteractionWindow>();
     interactionManager = new InteractionManager(_interaction, this);
     _fovObjectsWindow  = UserInterfaceManager.Get <FovWindow>();
     Components.Add(new EntityViewSyncComponent());
 }
        public static void Initialize()
        {
            // Initialize game window, set's the Global.CurrentScreen
            var gameWindow = new GameWindow(Constants.GameWindowWidth, Constants.GameWindowHeight);

            Add(gameWindow);

            // Initialize map
            var map = new MapWindow(Constants.Map.Width, Constants.Map.Height);

            Add(map);
            map.Initialize();

            // Initialize dialog window
            var dialogWindow = new DialogWindow(Constants.Map.Width, 6);

            Add(dialogWindow);

            // Initialize game over window
            var gameOverWindow = new GameOverWindow(Constants.GameWindowWidth, Constants.GameWindowHeight);

            Add(gameOverWindow);

            // Initialize inventory
            var inventory = new InventoryWindow(Constants.GameWindowWidth / 3, 15);

            Add(inventory);
            inventory.Initialize();

            var interaction = new InteractionWindow(Constants.GameWindowWidth / 3, 7);

            Add(interaction);

            var fovWindow = new FovWindow(Constants.GameWindowWidth / 3, 12);

            Add(fovWindow);

            var developerWindow = new DeveloperWindow(Constants.Map.Width, 14)
            {
                IsVisible = false
            };

            Add(developerWindow);

            IsInitialized = true;
        }
Esempio n. 3
0
    public void MoveToPoint(Vector3 screenPoint)
    {
        RaycastHit hit;

        if (Physics.Raycast(GameManager.Instance.CameraManager.SateliteCamera.ScreenPointToRay(screenPoint), out hit))
        {
            if (Map)
            {
                Vector3 worldPoint = Map.transform.InverseTransformPoint(hit.point);
                //~ Debug.Log(map.transform.InverseTransformPoint(hit.point)));
                Vector3 point = new Vector3(worldPoint.x * Map.transform.localScale.x, worldPoint.y * Map.transform.localScale.y, worldPoint.z * Map.transform.localScale.z);
                //~ Debug.Log(GameManager.Instance.xToLong(point.x));

                //Vector3 pos = new Vector3(((worldPoint.x - 5.0f) * map.transform.localScale.x) * -1, worldPoint.y, ((worldPoint.z + 5.0f) * map.transform.localScale.z));

                float a = GameManager.Instance.XMapModifier;
                float b = GameManager.Instance.YMapModifier;

                Vector3 pos2 = new Vector3();

                //y = -225a-1 + a-1x

                //pos2.x = -1347.305389f + 5.988023952f * hit.point.x;
                pos2.x = -GameManager.Instance.XMapAddition * Mathf.Pow(a, -1) + Mathf.Pow(a, -1) * hit.point.x;
                pos2.z = -GameManager.Instance.YMapAddtion * Mathf.Pow(b, -1) + Mathf.Pow(b, -1) * hit.point.z;
                pos2.y = Map.transform.position.y;

                Coordinate coordPoint = CoordinateHelper.FromOrthoProjectedCoordinate(pos2.z, pos2.x);

                GameObject      go     = new GameObject("PositionMarker");
                DetectionMarker marker = go.AddComponent <DetectionMarker>();
                //marker.Position = new Vector3(pos2.z, 0, pos2.x);
                marker.Position         = hit.point;
                marker.MinSize          = new Vector2(8, 8);
                marker.MaxSize          = new Vector2(128, 128);
                marker.KillTime         = 1;
                marker.FadeTime         = 0.5f;
                marker.MessageToDisplay = new Message("Movement", GameManager.MessageTypes.Game);
                //Debug.Log(pos2);


                //Vector3 pos = new Vector3();
                //pos.x = ((float)_Info.Position.LongitudeOrthoProjected * 0.1671117f) + 225.0f;
                //pos.z = ((float)_Info.Position.LatitudeOrthoProjected * -0.1675854f) + 360.0f;
                //pos.y = 30002;



                //Debug.Log(hit.point);
                //Gizmos.DrawCube(hit.point, new Vector3(10, 10, 10));

                //double lat = CoordinateHelper.YToLat(point.z);
                //double lng = CoordinateHelper.XToLong(point.x);
                //Debug.Log(string.Format("Lat:{0} , Long: {1}", lat, lng));

                bool removeWaypoints = true;
                if (Input.GetKey(KeyCode.LeftShift))
                {
                    removeWaypoints = false;
                }

                GameObject        gui = GameObject.Find("GUI");
                InteractionWindow iw  = gui.GetComponent <InteractionWindow>();

                if (iw.AwaitingOrder)
                {
                    iw.Move(coordPoint);
                }
                else
                {
                    GameManager.Instance.OrderManager.Move(coordPoint.Latitude, coordPoint.Longitude, GameManager.Instance.UnitManager.SelectedGroupMainUnit.Info, removeWaypoints);
                }
            }
        }
    }
 public InteractionManager(InteractionWindow interactionWindow, Player player)
 {
     this.interactionWindow = interactionWindow;
     _fovObjectsWindow      = UserInterfaceManager.Get <FovWindow>();
     this.player            = player;
 }