コード例 #1
0
ファイル: Harvester.cs プロジェクト: PondDev/BracketsProject
    public override void Down(Ray interactRay)
    {
        RaycastHit hitt;

        if (Physics.Raycast(interactRay, out hitt, PlayerInteraction.interactRange, LayerMask.GetMask("Harvestable")))
        {
            Harvestable obj = hitt.collider.GetComponent <Harvestable>();
            if (obj != null)
            {
                //maybe 2 different types?
                //  one that pops off
                //  one that you can just grab
                Sample newSample = SampleDatabase.Instance.GetSampleByID(obj.sampleId);
                if (obj.destroy)
                {
                    Object.Destroy(obj.gameObject);
                    SampleBehaviour.SpawnInWorld(newSample, hitt.point);
                    //GameObject newObj = Object.Instantiate(newSample.worldPrefab, obj.transform.position, Quaternion.identity);
                    //newObj.transform.localScale = obj.transform.localScale;
                }
                else
                {
                    SampleBehaviour.SpawnInWorld(newSample, hitt.point);
                }
            }
        }
    }
コード例 #2
0
 public void NewSample()
 {
     if (hold != null)
     {
         SampleBehaviour.SpawnInWorld(hold, outZone.position);
         hold     = null;
         inSample = null;
     }
 }
コード例 #3
0
    public void SpawnInWorld()
    {
        //remove from inv
        //this will need to change
        InventoryPanel.Instance.inventory.RemoveSampleAt(curSlotTransform.GetComponent <SlotData>().SlotIndex);

        //finding component for player isn't great
        PlayerMaster player = gameObject.GetComponentInParent <PlayerMaster>();

        SampleBehaviour.SpawnInWorld(sample, player.transform.position + player.transform.forward);
    }
コード例 #4
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);
                }
            }
        }
    }