示例#1
0
        private void OnTriggerStay(Collider other)
        {
            ++count;
            if (count > 1)
            {
                return;
            }

            spawnedLevel = PoolManagerScript.Spawn(levelPrefab, transform.position, Quaternion.identity);
        }
示例#2
0
        /// <summary>
        /// Instantiates the object in the scene using PoolManagerScript functionality.
        /// </summary>
        private void SpawnLoot()
        {
            var random = Random.Range(0, 100);
            int index  = CalculateRandom(random);

            if (obj != null)
            {
                return;
            }

            var spawPosition = new Vector3(transform.position.x, transform.position.y + 2.55f, transform.position.z);

            //use the poolmanager to spawn the loot on top of the plateforme
            obj = PoolManagerScript.Spawn(prefabs[index], spawPosition, prefabs[index].gameObject.transform.localRotation);

            var pObject = obj.GetComponent <PlayerObjectScript>();

            pObject.SetLootTrackerIndex(LootTracker.Count);
            LootTracker.Add(pObject);
        }