Ejemplo n.º 1
0
        private void SpawnFire()
        {
            PlayersWithinDistance(VulnerabilityRange).ForEach(o => o.AddComponent <Vulnerability>().Duration = 2);
            var availablePlayers = PlayersWithinDistance(FireRange);

            if (!availablePlayers.Any())
            {
                return;
            }
            var     target = availablePlayers.ElementAt(Random.Range(0, availablePlayers.Count));
            Vector3 targetPos;

            if (PositionUtil.HighestTerrain(target.transform.position, out targetPos))
            {
                Instantiate(FirePrefab, targetPos, FirePrefab.transform.rotation);
            }
        }