override public void ShowGUI (List<ActionParameter> parameters)
		{
			parameterID = Action.ChooseParameterGUI ("Object to check:", parameters, parameterID, ParameterType.GameObject);
			if (parameterID >= 0)
			{
				constantID = 0;
				dragObject = null;
			}
			else
			{
				dragObject = (DragBase) EditorGUILayout.ObjectField ("Object to check:", dragObject, typeof (DragBase), true);

				constantID = FieldToID <DragBase> (dragObject, constantID);
				dragObject = IDToField <DragBase> (dragObject, constantID, false);
			}
		}
Ejemplo n.º 2
0
	protected void SharedGUI (DragBase _target, bool isOnHinge)
	{
		EditorGUILayout.BeginVertical ("Button");
			EditorGUILayout.LabelField ("Collision settings:", EditorStyles.boldLabel);
			_target.ignorePlayerCollider = EditorGUILayout.ToggleLeft ("Ignore Player's collider?", _target.ignorePlayerCollider);
			_target.ignoreMoveableRigidbodies = EditorGUILayout.ToggleLeft ("Ignore Moveable Rigidbodies?", _target.ignoreMoveableRigidbodies);
			_target.childrenShareLayer = EditorGUILayout.ToggleLeft ("Place children on same layer?", _target.childrenShareLayer);
		EditorGUILayout.EndVertical ();

		EditorGUILayout.BeginVertical ("Button");
			EditorGUILayout.LabelField ("Icon settings:", EditorStyles.boldLabel);
			_target.showIcon = EditorGUILayout.Toggle ("Icon at contact point?", _target.showIcon);
			if (_target.showIcon)
			{
				if (cursorManager && cursorManager.cursorIcons.Count > 0)
				{
					int cursorInt = cursorManager.GetIntFromID (_target.iconID);
					cursorInt = EditorGUILayout.Popup ("Cursor icon:", cursorInt, cursorManager.GetLabelsArray (cursorInt));
					_target.iconID = cursorManager.cursorIcons [cursorInt].id;
				}
				else
				{
					_target.iconID = -1;
				}
			}		
		EditorGUILayout.EndVertical ();

		EditorGUILayout.BeginVertical ("Button");
			EditorGUILayout.LabelField ("Sound settings:", EditorStyles.boldLabel);
			_target.moveSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Move sound:", _target.moveSoundClip, typeof (AudioClip), false);
			_target.slideSoundThreshold = EditorGUILayout.FloatField ("Min. move speed:", _target.slideSoundThreshold);
			_target.slidePitchFactor = EditorGUILayout.FloatField ("Pitch factor:", _target.slidePitchFactor);
			_target.collideSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Collide sound:", _target.collideSoundClip, typeof (AudioClip), false);
			if (isOnHinge)
			{
				_target.onlyPlayLowerCollisionSound = EditorGUILayout.Toggle ("Only on lower boundary?", _target.onlyPlayLowerCollisionSound);
			}
		EditorGUILayout.EndVertical ();
	}
Ejemplo n.º 3
0
 /**
  * <summary>Checks if a specific DragBase object is being held by the player.</summary>
  * <param name "_dragBase">The DragBase to check for</param>
  * <returns>True if the DragBase object is being held by the Player</returns>
  */
 public bool IsDragObjectHeld(DragBase _dragBase)
 {
     if (_dragBase == null || dragObject == null)
     {
         return false;
     }
     if (_dragBase == dragObject)
     {
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
 private void LetGo(bool unlockFPSCamera)
 {
     dragObject.LetGo ();
     dragObject = null;
 }
Ejemplo n.º 5
0
        private void Grab()
        {
            if (dragObject)
            {
                dragObject.LetGo ();
                dragObject = null;
            }
            else if (canDragMoveable)
            {
                canDragMoveable = false;

                Ray ray = Camera.main.ScreenPointToRay (mousePosition);
                RaycastHit hit = new RaycastHit ();

                if (Physics.Raycast (ray, out hit, KickStarter.settingsManager.moveableRaycastLength))
                {
                    if (hit.transform.GetComponent <DragBase>())
                    {
                        dragObject = hit.transform.GetComponent <DragBase>();
                        dragObject.Grab (hit.point);
                        lastMousePosition = mousePosition;
                        lastCameraPosition = Camera.main.transform.position;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void LetGo(bool unlockFPSCamera)
        {
            dragObject.LetGo ();
            dragObject = null;

            if (unlockFPSCamera && KickStarter.settingsManager.movementMethod == MovementMethod.UltimateFPS && KickStarter.settingsManager.disableFreeAimWhenDragging)
            {
                UltimateFPSIntegration.SetCameraState (true);
            }
        }
Ejemplo n.º 7
0
        private void Grab()
        {
            if (dragObject)
            {
                dragObject.LetGo ();
                dragObject = null;
            }
            else if (canDragMoveable)
            {
                canDragMoveable = false;

                Ray ray = Camera.main.ScreenPointToRay (mousePosition);
                RaycastHit hit = new RaycastHit ();

                if (Physics.Raycast (ray, out hit, KickStarter.settingsManager.moveableRaycastLength))
                {
                    if (hit.transform.GetComponent <DragBase>())
                    {
                        dragObject = hit.transform.GetComponent <DragBase>();
                        dragObject.Grab (hit.point);
                        lastMousePosition = mousePosition;
                        lastCameraPosition = Camera.main.transform.position;

                        if (KickStarter.settingsManager.movementMethod == MovementMethod.UltimateFPS && KickStarter.settingsManager.disableFreeAimWhenDragging)
                        {
                            UltimateFPSIntegration.SetCameraState (false);
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public override void AssignValues(List<ActionParameter> parameters)
 {
     dragObject = AssignFile <DragBase> (parameters, parameterID, constantID, dragObject);
 }
Ejemplo n.º 9
0
 override public void AssignValues(List <ActionParameter> parameters)
 {
     dragObject = AssignFile <DragBase> (parameters, parameterID, constantID, dragObject);
 }
Ejemplo n.º 10
0
        protected void SharedGUI(DragBase _target, bool isOnHinge)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Collision settings:", EditorStyles.boldLabel);
            _target.ignorePlayerCollider      = CustomGUILayout.ToggleLeft("Ignore Player's collider?", _target.ignorePlayerCollider, "", "If True, then the Physics system will ignore collisions between this object and the player");
            _target.ignoreMoveableRigidbodies = CustomGUILayout.ToggleLeft("Ignore Moveable Rigidbodies?", _target.ignoreMoveableRigidbodies, "", " If True, then the Physics system will ignore collisions between this object and the bounday colliders of any DragTrack that this is not locked to");
            _target.childrenShareLayer        = CustomGUILayout.ToggleLeft("Place children on same layer?", _target.childrenShareLayer, "", "If True, then this object's children will be placed on the same layer");

            EditorGUILayout.BeginHorizontal();
            _target.interactiveBoundary = (InteractiveBoundary)CustomGUILayout.ObjectField <InteractiveBoundary> ("Interactive boundary:", _target.interactiveBoundary, true, "", "If assigned, then the draggable will only be interactive when the player is within this Trigger Collider's boundary");
            if (_target.interactiveBoundary == null)
            {
                if (GUILayout.Button("Create", GUILayout.MaxWidth(90f)))
                {
                    string prefabName = "InteractiveBoundary";
                    if (SceneSettings.IsUnity2D())
                    {
                        prefabName += "2D";
                    }
                    InteractiveBoundary newInteractiveBoundary = SceneManager.AddPrefab("Logic", prefabName, true, false, true).GetComponent <InteractiveBoundary>();
                    newInteractiveBoundary.gameObject.name   += (": " + _target.gameObject.name);
                    newInteractiveBoundary.transform.position = _target.transform.position;
                    _target.interactiveBoundary = newInteractiveBoundary;

                    UnityVersionHandler.PutInFolder(newInteractiveBoundary.gameObject, "_Hotspots");
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Icon settings:", EditorStyles.boldLabel);
            _target.showIcon = CustomGUILayout.Toggle("Icon at contact point?", _target.showIcon, "", "If True, then an icon will be displayed at the 'grab point' when the object is held");
            if (_target.showIcon)
            {
                if (cursorManager && cursorManager.cursorIcons.Count > 0)
                {
                    int cursorInt = cursorManager.GetIntFromID(_target.iconID);
                    cursorInt      = CustomGUILayout.Popup("Cursor icon:", cursorInt, cursorManager.GetLabelsArray(), "", "The cursor that gets shown when held");
                    _target.iconID = cursorManager.cursorIcons [cursorInt].id;
                }
                else
                {
                    _target.iconID = -1;
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Sound settings:", EditorStyles.boldLabel);
            _target.moveSoundClip       = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Move sound:", _target.moveSoundClip, false, "", "The sound to play when the object is moved");
            _target.slideSoundThreshold = CustomGUILayout.FloatField("Min. move speed:", _target.slideSoundThreshold, "", "The minimum speed that the object must be moving by for sound to play");
            _target.slidePitchFactor    = CustomGUILayout.FloatField("Pitch factor:", _target.slidePitchFactor, "", "The factor by which the movement sound's pitch is adjusted in relation to speed");

            _target.collideSoundClip = (AudioClip)CustomGUILayout.ObjectField <AudioClip> ("Collide sound:", _target.collideSoundClip, false, "", "The sound to play when the object has a collision");
            if (isOnHinge)
            {
                _target.onlyPlayLowerCollisionSound = CustomGUILayout.Toggle("Only on lower boundary?", _target.onlyPlayLowerCollisionSound, "", "If True, then the collision sound will only play when the object collides with its lower boundary collider");
            }
            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 11
0
 /**
  * <summaryThe default constructor</summary>
  * <param name="_dragBase">The object to drag</param>
  */
 public HeldObjectData(DragBase _dragBase)
 {
     dragBase        = _dragBase;
     touchIndex      = -1;
     ignoreDragState = false;
 }