-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rework containers * Make container display draggable * Add clothing containers * Add drag and drop * Fix dragged item blocking itself * Refactor item drag and drop * Fix certain items having 0 size * Remove unecessary logging * Fix dropped items clipping into the ground * Allow interacting in hand by clicking * Fix broken suit storage
- Loading branch information
Showing
160 changed files
with
10,798 additions
and
11,534 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,52 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using SS3D.Engine.Interactions.Extensions; | ||
using SS3D.Engine.Inventory.Extensions; | ||
using UnityEngine; | ||
using UnityEngine.XR; | ||
|
||
public class Creature : MonoBehaviour | ||
{ | ||
// Start is called before the first frame update | ||
void Start() | ||
public float ViewRange = 10f; | ||
|
||
private Hands hands; | ||
|
||
public Hands Hands | ||
{ | ||
get | ||
{ | ||
if (hands == null) | ||
{ | ||
hands = GetComponent<Hands>(); | ||
} | ||
|
||
return hands; | ||
} | ||
set => hands = value; | ||
} | ||
|
||
/// <summary> | ||
/// Checks if this creature can view a game object | ||
/// </summary> | ||
/// <param name="otherObject">The game object to view</param> | ||
public bool CanSee(GameObject otherObject) | ||
{ | ||
|
||
// TODO: This should be based on a health/organ system | ||
return Vector3.Distance(gameObject.transform.position, otherObject.transform.position) <= ViewRange; | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
/// <summary> | ||
/// Checks if the creature can interact with an object | ||
/// </summary> | ||
/// <param name="otherObject">The game object to interact with</param> | ||
public bool CanInteract(GameObject otherObject) | ||
{ | ||
|
||
Hands hand = Hands; | ||
if (hand == null) | ||
{ | ||
return false; | ||
} | ||
|
||
return hand.GetInteractionRange().IsInRange(hand.InteractionOrigin, otherObject.transform.position); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.