Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     vxe   = VoxelExtractionPointCloud.Instance;
     biome = BiomeScript.Instance;
     //for (int i=0; i<spawnObjects.Length; i++)
     //	spawnObjects[i].SetActive (false);
 }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     vxe = VoxelExtractionPointCloud.Instance;
     biome = BiomeScript.Instance;
     //for (int i=0; i<spawnObjects.Length; i++)
     //	spawnObjects[i].SetActive (false);
 }
Esempio n. 3
0
 // Use this for initialization
 protected override void Start()
 {
     base.Start ();
     biomeScript = BiomeScript.Instance;
     Vec3Int chunkCoords = vxe.getChunkCoords (transform.position);
     vxe.chunkGameObjects [chunkCoords.x,chunkCoords.y,chunkCoords.z].GetComponent<MeshRenderer> ().material = vxe.debugMaterial;
 }
Esempio n. 4
0
    // Use this for initialization
    protected override void Start()
    {
        base.Start();
        biomeScript = BiomeScript.Instance;
        Vec3Int chunkCoords = vxe.getChunkCoords(transform.position);

        vxe.chunkGameObjects [chunkCoords.x, chunkCoords.y, chunkCoords.z].GetComponent <MeshRenderer> ().material = vxe.debugMaterial;
    }
Esempio n. 5
0
    private void OnCollisionEnter(Collision collision)
    {
        // move this to inside scriptable obj
        if (itembase is Weapon && collision.gameObject.tag == "Enemy")
        {
            //get enemy component
            EnemyCard enemy = collision.gameObject.GetComponent <EnemyCard>();
            //cast to weapon type
            Weapon weapon = (Weapon)itembase;
            //use weapon
            weapon.Attack(enemy);
            DecreaseDurability();
        }
        else if (collision.gameObject.tag == "Obstacle")
        {
            BiomeScript biome = collision.gameObject.GetComponent <BiomeScript>();
            List <Item> drops = biome.Interact(itembase);
            foreach (Item drop in drops)
            {
                theInv.AddToInventory(drop);
            }
            DecreaseDurability();
        }
        else if (itembase is Material && collision.gameObject.tag == "Pickable")
        {
            if (collision.gameObject.GetComponent <ItemScript>().GetInstanceID() > this.GetInstanceID() || !canCraft || !collision.gameObject.GetComponent <ItemScript>().canCraft)
            {
            }
            else
            {
                Item result;
                //get other component
                Item other = collision.gameObject.GetComponent <ItemScript>().itembase;
                //cast to material type
                Material material = (Material)itembase;
                if (material.Craft(other, out result))
                {
                    canCraft = false;
                    collision.gameObject.GetComponent <ItemScript>().canCraft = false;
                    //create from result
                    theInv.RemoveFromInventory(collision.gameObject.GetComponent <ItemScript>().inventoryIndex);
                    theInv.RemoveFromInventory(inventoryIndex);
                    theInv.AddToInventory(result);
                }
            }
        }

        //Return to hand
        if (reset)
        {
            GetComponent <Rigidbody>().isKinematic = true;
            transform.localPosition = inventoryPos;
            reset = false;
        }
    }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        vxe = VoxelExtractionPointCloud.Instance;
        biome = BiomeScript.Instance;
        defaultFlag = leftcam.clearFlags;
        defaultLightIntensity = light.intensity;
        fourpts = new Vector3[2];

        if(cubeswitch != null)
        {
            initPts();
        }
    }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        //Initialize VBariables
        biome = BiomeScript.Instance;
        vxe = VoxelExtractionPointCloud.Instance;
        mybiome = biome.biomeArea [0].biome;
        au_source = GetComponent<AudioSource> ();
        if (playerTrans == null)
            playerTrans = GameObject.FindWithTag ("Player").GetComponent<Transform> ();

        /*playerCC = vxe.getChunkCoords (playerTrans.position);
        mybiome = biome.biomeMap [playerCC.x, playerCC.z];
        prevBiome = mybiome;
        switchBiomeAudio (mybiome);
        */
        StartCoroutine (waitToInitialize ());
    }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        vxe             = VoxelExtractionPointCloud.Instance;
        biome           = BiomeScript.Instance;
        mybiome         = biome.biomeArea [0].biome;
        occupiedNearMe  = new List <Chunks> ();
        assetChunkTable = new Dictionary <Vec3Int, GameObject> ();

        if (playerTrans == null)
        {
            playerTrans = GameObject.FindWithTag("Player").GetComponent <Transform> ();
        }

        spawns = new IndexStack <SpawnObject> (new SpawnObject[max_spawns + 20]);
        StartCoroutine(FullPullSpawn());
        StartCoroutine(MaintainSpawns());
    }
Esempio n. 9
0
    void Start()
    {
        //spawneditems = new GameObject[items.Length];


        //for (int i=0; i<items.Length; i++)
        //	spawneditems [i] = null;

        prevpositions = new IndexStack <Vec3Int> (new Vec3Int[20]);

        vxe = VoxelExtractionPointCloud.Instance;
        if (camera == null)
        {
            camera = vxe.camera;
        }
        biome = BiomeScript.Instance;
    }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        StartCoroutine(findFloor());
        foreach (BiomeSpawn bm in currentBiomeSpawn)
        {
            spawnTable.Add(bm.biome, bm);
        }
        vxe           = VoxelExtractionPointCloud.Instance;
        biome         = BiomeScript.Instance;
        thingsSpawned = new List <GameObject> ();

        if (playerTrans == null)
        {
            playerTrans = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform> ();
        }
        //Debug Test for whether to use ActiveInHiearchy vs ActiveSelf
        //Debug.Log (string.Format ("Portal Active In Hiearchay {0} , Portal Active Self {1} ", portal.activeInHierarchy, portal.activeSelf));
    }
Esempio n. 11
0
    // Use this for initialization
    void Start()
    {
        //Initialize VBariables
        biome     = BiomeScript.Instance;
        vxe       = VoxelExtractionPointCloud.Instance;
        mybiome   = biome.biomeArea [0].biome;
        au_source = GetComponent <AudioSource> ();
        if (playerTrans == null)
        {
            playerTrans = GameObject.FindWithTag("Player").GetComponent <Transform> ();
        }

        /*playerCC = vxe.getChunkCoords (playerTrans.position);
         * mybiome = biome.biomeMap [playerCC.x, playerCC.z];
         * prevBiome = mybiome;
         * switchBiomeAudio (mybiome);
         */
        StartCoroutine(waitToInitialize());
    }
Esempio n. 12
0
    // Use this for initialization
    void Start()
    {
        vxe = VoxelExtractionPointCloud.Instance;
        biome = BiomeScript.Instance;
        mybiome = biome.biomeArea [0].biome;
        occupiedNearMe = new List<Chunks> ();
        assetChunkTable = new Dictionary<Vec3Int, GameObject> ();

        if (playerTrans == null)
            playerTrans = GameObject.FindWithTag ("Player").GetComponent<Transform> ();

        InitializeEnvironmentBiome (ref desertGameObjects, "DesertAssets", ref desertAssets);
        InitializeEnvironmentBiome (ref grassGameObjects, "GrassAssets", ref grassAssets);
        InitializeEnvironmentBiome (ref IceGameObjects, "IceAssets", ref iceAssets);
        InitializeEnvironmentBiome (ref marshGameObjects, "MarshAssets", ref marshAssets);
        spawns = new IndexStack<SpawnObject> (new SpawnObject[max_spawns]);
        StartCoroutine (FullPullSpawn ());
        StartCoroutine (MaintainSpawns ());
    }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        StartCoroutine (findFloor ());
        foreach (BiomeSpawn bm in currentBiomeSpawn) {
            spawnTable.Add (bm.biome, bm);
        }
        vxe = VoxelExtractionPointCloud.Instance;
        biome = BiomeScript.Instance;
        thingsSpawned = new List<GameObject> ();

        if (playerTrans == null)
            playerTrans = GameObject.FindGameObjectWithTag ("Player").GetComponent<Transform> ();
        //Debug Test for whether to use ActiveInHiearchy vs ActiveSelf
        //Debug.Log (string.Format ("Portal Active In Hiearchay {0} , Portal Active Self {1} ", portal.activeInHierarchy, portal.activeSelf));
    }
Esempio n. 14
0
 public void RemoveFromList(BiomeScript biomeCard)
 {
     biomeList.Remove(biomeCard);
     Destroy(biomeCard.gameObject);
 }
Esempio n. 15
0
 public void AddToList(BiomeScript biomeCard)
 {
     biomeList.Add(biomeCard);
 }