コード例 #1
0
 public void DestroySample()
 {
     if (curSample != null)
     {
         curSample.GetComponent <SceneObject>().DestroySceneObj();
     }
 }
コード例 #2
0
    // 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;
    }
コード例 #3
0
ファイル: Oven.cs プロジェクト: PondDev/BracketsProject
    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);
                }
            }
        }
    }
コード例 #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();
            }
        }
    }
コード例 #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();
            }
        }
    }