public void Place(PlacementSurface surface) { if (surface.GetComponent <SinkSurface>()) { throw new ArgumentException("Can't place food in Sink", nameof(surface)); } throw new NotImplementedException(); }
// Update is called once per frame void Update() { Vector3 playerPos = Camera.main.transform.position; Vector3 gazeDir = Camera.main.transform.forward; RaycastHit info; // check player's line of sight for a wall if (Physics.Raycast(new Ray(playerPos, gazeDir), out info, gazeDistance, raycastLayers, QueryTriggerInteraction.Ignore)) { targetPosition = info.point; normal = info.normal; TestCursor.transform.position = targetPosition; TestCursor.GetComponent <Renderer>().material.color = wall; //check the normal of the surface and change color to show type if (Mathf.Abs(Vector3.Dot(Vector3.up, info.normal)) < 0.5f) { TestCursor.GetComponent <Renderer>().material.color = wall; mTargetSurface = PlacementSurface.Wall; } else if (Vector3.Dot(Vector3.up, info.normal) > 0) { TestCursor.GetComponent <Renderer>().material.color = ceiling; mTargetSurface = PlacementSurface.Ceiling; } else if (Vector3.Dot(Vector3.up, info.normal) < 0) { TestCursor.GetComponent <Renderer>().material.color = floor; mTargetSurface = PlacementSurface.Floor; } else { TestCursor.GetComponent <Renderer>().material.color = invalid; mTargetSurface = PlacementSurface.Invalid; } } }
public virtual bool IsValidSurface(PlacementSurface surface) { return(surface != PlacementSurface.Invalid); }
public void Place(PlacementSurface surface) { throw new NotImplementedException(); }
public override bool IsValidSurface(PlacementSurface surface) { return(surface == PlacementSurface.Ceiling || surface == PlacementSurface.Wall); }
// Use this for initialization void Awake() { placementSurface = placementSurface ?? GetComponent <PlacementSurface>(); }