using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MeshMakerNamespace;

public class RuntimeCSGFlatlandObject : MonoBehaviour
{
    public PlayerMovement player;
    public GameObject crosssection;
    public Mesh m;
    public FlatlandMovement original;

    public double clock = 0;

    //public CSG csg;
    // Start is called before the first frame update
    void Start()
    {
        
        //PastLightCone = GameObject.Find("Cone");
        
        Physics.IgnoreLayerCollision(8, 8);
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        if(player == null && original != null)
        {
            player = original.levelManager.player;
        }
        if (original != player && original.isClock)
        {
            var tmp = new Vector3(player.transform.position.x - transform.position.x, 0, player.transform.position.z - transform.position.z);
            if (Mathf.Abs((player.transform.position.y - transform.position.y) - (tmp.magnitude)) < 0.1)
            {
                if (original.apparenttime < clock)
                    original.apparenttime = clock;
            }
        }
    }

    

    
}
