Esempio n. 1
0
        public void ControllerUpdate()
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (!EventSystem.current.IsPointerOverGameObject() &&
                Physics.Raycast(ray, out var hitInfo))
            {
                var target = hitInfo.transform.GetComponent <Selectable>();
                if (Input.GetButton("BoatMove") && Vector3.Distance(_targetLocation, hitInfo.point) > LocationChangedMinDistance)
                {
                    TargetLocationChanged?.Invoke(this, new TargetChangedArg(hitInfo.point, target));
                    _targetLocation = hitInfo.point;
                }
                if (Input.GetButton("BoatAction") && target != null)
                {
                    TargetCommandChanged?.Invoke(this, new TargetChangedArg(hitInfo.point, target));
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This checks the list of possible locations and changes the target location.
        /// </summary>
        /// <param name="newLocation"></param>
        public void ChangeTargetLocation(string newLocation)
        {
            if (newLocation == "")
            {
                TargetLocation = "";
                TargetLocationChanged?.Invoke(null, "");
                return;
            }

            int counter = 0;

            foreach (string location in GetAllLocations())
            {
                if (location.Contains(newLocation))
                {
                    TargetLocation = location;
                    string finalLocation = location + " - " + GetAllLocations(slovak: true)[counter]; //TODO: GetAllLocations(slovak:<boolvalue>) seems odd
                    TargetLocationChanged?.Invoke(null, finalLocation);

                    return;
                }
                counter++;
            }
        }