using UnityEngine;

public class CatchObjects : InteractableObject {

    public static GameObject m_reacteur = null;
    public static GameObject m_aile01 = null;
    public static GameObject m_aile02 = null;

    public static GameObject catchedObject = null;

    public static int objectsToCatch = 0;

    [HideInInspector] public bool wasCatched = false;

    protected override void Start()
    {
        base.Start();
        m_reacteur = GameObject.Find("Reacteur");
        m_aile01 = GameObject.Find("Aile01");
        m_aile02 = GameObject.Find("Aile02");
        objectsToCatch++;
    }

    protected override void DoActionUp() {
        base.DoActionUp();
        if (catchedObject == null) {
            catchedObject = gameObject;
        }
    }

    protected override void Update() {

        if (!wasCatched) {
            base.Update();
            if (catchedObject != null) {
                catchedObject.transform.position = Camera.main.transform.position + 3 * Camera.main.transform.forward - (catchedObject == m_reacteur ? 1 : 0.5f) * Camera.main.transform.up;
            }
        }
    }
}