Example #1
0
    public void PlaceItem(GameObject Plane)
    {
        Debug.Log("trying to place Item");
        if (activeItem == null)
        {
            return;
        }

        PlaneChecking planeChecking = Plane.GetComponent <PlaneChecking>();

        if (!planeChecking.blocked && planeChecking.playerTouched)
        {
            Instantiate(Resources.Load(activeItem.GetComponent <Item>().modell), Plane.transform);
            Camera.main.GetComponentInParent <AudioSource>().Play();
            planeChecking.blocked = true;
            RemoveItem(activeItem.GetComponent <Item>());
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <PlaneChecking>() != null)
        {
            PlaneChecking planeCheck = other.GetComponent <PlaneChecking>();

            Debug.Log("planedetection onTriggerEnter");

            if (planeCheck.walkable)
            {
                if (detection.freePlanes != null)
                {
                    if (!detection.freePlanes.Contains(other.gameObject))
                    {
                        detection.freePlanes.Add(other.gameObject);
                        //Debug.Log(detection.freePlanes);
                    }
                }
            }
        }
    }