public void DestroySample()
 {
     if (curSample != null)
     {
         curSample.GetComponent <SceneObject>().DestroySceneObj();
     }
 }
    // Use this for initialization
    void Start()
    {
        sampleSpring             = sample.gameObject.AddComponent <SpringJoint>();
        sampleSpring.anchor      = sample.transform.InverseTransformPoint(this.transform.position);
        sampleSpring.maxDistance = 0.01f;

        sampleOldDrag = sample.GetComponent <Rigidbody>().drag;
    }
Beispiel #3
0
    void FulfilTest()
    {
        //can use layer mask here (probably should)
        Collider[] hits = Physics.OverlapSphere(outZone.position, castRadius);

        foreach (Collider hit in hits)
        {
            SampleBehaviour sample = hit.GetComponent <SampleBehaviour>();
            if (sample != null)
            {
                Sample hold = tester.TestSample(sample.sample);
                if (hold != null)
                {
                    sample.GetComponent <SceneObject>().DestroySceneObj();
                    SampleBehaviour.SpawnInWorld(hold, outZone.position);
                }
            }
        }
    }
Beispiel #4
0
    public void DestroySample()
    {
        if (inSample != null)
        {
            hold = tester.TestSample(inSample.sample);

            //TEMP
            if (inSample.id == 3)
            {
                TempTasksManager.instance.UpdateCurrentTask(3);
            }
            //

            inSample.GetComponent <SceneObject>().DestroySceneObj();
            foreach (ParticleSystem system in particles)
            {
                system.Play();
            }
        }
    }
Beispiel #5
0
    // Update is called once per frame
    public void Tick(float delta)
    {
        //Input lock
        if (input.inputOn)
        {
            //Interaction Cast
            RaycastHit hitt;
            interactRay = new Ray(camera.camInstance.transform.position, camera.camInstance.transform.forward);

            if (Physics.Raycast(interactRay, out hitt, interactRange, LayerMask.GetMask("Interactable")))
            {
                IInteractable obj = hitt.collider.GetComponent <IInteractable>();
                if (obj != null)
                {
                    //Hovering on interactables
                    if (obj == hitLastFrame)
                    {
                        obj.OnHover();
                    }
                    else
                    {
                        obj.OnHoverEnter();
                        if (hitLastFrame != null)
                        {
                            hitLastFrame.OnHoverExit();
                            hitLastFrame = null;
                        }
                    }

                    //Interaction on interactables
                    if (Input.GetKeyDown(input.Interact.key))
                    {
                        obj.Interact(master);
                    }
                    else if (carrying)
                    {
                        if (input.Pocket.Down)
                        {
                            SampleBehaviour sampleIn = hitt.collider.GetComponent <SampleBehaviour>();
                            if (sampleIn != null)
                            {
                                //Add sample to inv if possible then destroy
                                if (inv.AddSample(sampleIn.sample))
                                {
                                    sampleIn.GetComponent <SceneObject>().DestroySceneObj();

                                    //Object.Destroy(hitt.collider.gameObject);
                                    carrying = false;
                                }
                            }
                        }
                    }
                    hitLastFrame = obj;
                }
                else if (hitLastFrame != null)
                {
                    Cleanup();
                }
            }
            else if (hitLastFrame != null)
            {
                Cleanup();
            }
        }
    }