Exemplo n.º 1
0
 public void SpawnEggsAtPoint(int numEggs, Vector3 pos, Vector3 aimDir, float minDist = 1f, float maxDist = 2f)
 {
     for (int i = 0; i < numEggs; i++)
     {
         Vector3 vector = pos;
         aimDir   = ((!(aimDir == Vector3.zero)) ? AimConeUtil.GetModifiedAimConeDirection(90f, aimDir) : UnityEngine.Random.onUnitSphere);
         vector   = pos + Vector3Ex.Direction2D(pos + aimDir * 10f, pos) * UnityEngine.Random.Range(minDist, maxDist);
         vector.y = TerrainMeta.HeightMap.GetHeight(vector);
         CollectableEasterEgg collectableEasterEgg = GameManager.server.CreateEntity(HuntablePrefab[UnityEngine.Random.Range(0, HuntablePrefab.Length)].resourcePath, vector) as CollectableEasterEgg;
         collectableEasterEgg.Spawn();
         _spawnedEggs.Add(collectableEasterEgg);
     }
 }
 public void SpawnEggsAtPoint(int numEggs, Vector3 pos, Vector3 aimDir, float minDist = 1f, float maxDist = 2f)
 {
     for (int i = 0; i < numEggs; i++)
     {
         Vector3 height = pos;
         if (aimDir != Vector3.zero)
         {
             aimDir = AimConeUtil.GetModifiedAimConeDirection(90f, aimDir, true);
         }
         else
         {
             aimDir = UnityEngine.Random.onUnitSphere;
         }
         height   = pos + (Vector3Ex.Direction2D(pos + (aimDir * 10f), pos) * UnityEngine.Random.Range(minDist, maxDist));
         height.y = TerrainMeta.HeightMap.GetHeight(height);
         GameManager          gameManager          = GameManager.server;
         string               eggPrefabs           = this.EggPrefabs[UnityEngine.Random.Range(0, (int)this.EggPrefabs.Length)].resourcePath;
         Quaternion           quaternion           = new Quaternion();
         CollectableEasterEgg collectableEasterEgg = gameManager.CreateEntity(eggPrefabs, height, quaternion, true) as CollectableEasterEgg;
         collectableEasterEgg.Spawn();
         this._spawnedEggs.Add(collectableEasterEgg);
     }
 }