Exemple #1
0
 public void Place(PlacementSurface surface)
 {
     if (surface.GetComponent <SinkSurface>())
     {
         throw new ArgumentException("Can't place food in Sink", nameof(surface));
     }
     throw new NotImplementedException();
 }
Exemple #2
0
    // 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;
            }
        }
    }
Exemple #3
0
 public virtual bool IsValidSurface(PlacementSurface surface)
 {
     return(surface != PlacementSurface.Invalid);
 }
Exemple #4
0
 public void Place(PlacementSurface surface)
 {
     throw new NotImplementedException();
 }
Exemple #5
0
 public override bool IsValidSurface(PlacementSurface surface)
 {
     return(surface == PlacementSurface.Ceiling || surface == PlacementSurface.Wall);
 }
Exemple #6
0
 // Use this for initialization
 void Awake()
 {
     placementSurface = placementSurface ?? GetComponent <PlacementSurface>();
 }