Пример #1
0
    public GameObject RunebookGO()
    {
        Zone zone = new Zone(7);
        int  i    = 0;

        for (int x = 0; x < 7; x++)
        {
            for (int y = 0; y < 7; y++)
            {
                if (zone.tiles[x, y].type != TileType.None)
                {
                    if (i < 32)
                    {
                        zone.tiles[x, y] = runes[i].tile;
                        i++;
                    }
                }
            }
        }
        GameObject   rr = GameObject.Find("RuneRenderer");
        ZoneRenderer zr = rr.GetComponent <ZoneRenderer>();
        ZoneManager  zm = rr.GetComponent <ZoneManager>();

        //GameObject output = zr.RenderZone(zone, zm.regularTileSet)[0];
        return(zr.RenderZone(zone, zm.regularTileSet)[0]);
    }
Пример #2
0
    public override void SetEntity(ZoneRenderer zoneRenderer, Entity entity)
    {
        base.SetEntity(zoneRenderer, entity);
        var ship = entity as Ship;

        if (ship == null)
        {
            Debug.LogError($"Attempted to assign non-ship entity to {gameObject.name} ship instance prefab!");
            return;
        }
        Ship = ship;
        var drive = ship.GetBehavior <AetherDrive>();

        if (drive != null)
        {
            var particles = Instantiate(UnityHelpers.LoadAsset <ParticleSystem>(drive.DriveData.Particles), transform, false);
            var main      = particles.main;
            main.customSimulationSpace = LocalSpace;
            _aetherDrive = new AetherDriveInstance
            {
                Drive        = drive,
                BaseEmission = particles.emission.rateOverTimeMultiplier,
                Particles    = particles,
                BaseForce    = particles.forceOverLifetime.z.curveMultiplier
            };
        }
        _thrusters = ship.GetBehaviors <Thruster>().Select(thruster =>
        {
            var effectData        = (ThrusterData)thruster.Data;
            var particles         = Instantiate(UnityHelpers.LoadAsset <ParticleSystem>(effectData.ParticlesPrefab), transform, false);
            var particlesShape    = particles.shape;
            var thrusterHardpoint = ThrusterHardpoints
                                    .FirstOrDefault(t => t.name == ship.Hardpoints[thruster.Item.Position.x, thruster.Item.Position.y].Transform);
            particlesShape.meshRenderer = thrusterHardpoint?.Emitter;
            // if (!string.IsNullOrEmpty(thruster.Item.Data.SoundEffectTrigger) && thrusterHardpoint != null)
            // {
            //     AkSoundEngine.RegisterGameObj(thrusterHardpoint.gameObject);
            //     AkSoundEngine.PostEvent(thruster.Item.Data.SoundEffectTrigger, thrusterHardpoint.gameObject);
            // }

            return(new ThrusterInstance
            {
                Thruster = thruster,
                System = particles,
                BaseEmission = particles.emission.rateOverTimeMultiplier,
                MaxParticleCount = 0
            });
        })
                     .ToArray();

        foreach (var particle in _thrusters)
        {
            particle.System.gameObject.SetActive(false);
        }
    }
Пример #3
0
    public GameObject RuneGO()
    {
        Zone zone = new Zone(1);

        zone.tiles[0, 0] = tile;
        GameObject   rr = GameObject.Find("RuneRenderer");
        ZoneRenderer zr = rr.GetComponent <ZoneRenderer>();
        ZoneManager  zm = rr.GetComponent <ZoneManager>();

        return(zr.RenderZone(zone, zm.regularTileSet)[0]);
    }
Пример #4
0
    void InitializeZone()
    {
        zoneManager  = GameObject.FindWithTag("Zone Manager").GetComponent <ZoneManager>();
        zoneRenderer = zoneManager.GetComponent <ZoneRenderer>();

        // --- Input

        // --- Network

        // --- Zone
        if (currentZoneObjects != null && currentZoneObjects.Count > 0)
        {
            foreach (GameObject g in currentZoneObjects)
            {
                Destroy(g);
            }
        }
        int  safety       = 100;
        bool buildingZone = true;
        int  minimumSize  = 50;

        Triangle tri = new Triangle(new Vector3(0, 0, 0), new Vector3(18, 0, 24), new Vector3(0, 0, 36));

        while (buildingZone)
        {
            currentZone = new Zone(tri);

            if (currentZone.landArea > minimumSize)
            {
                Debug.Log("Zone generated with a land mass of " + currentZone.landArea + " hex.");
                buildingZone = false;
            }
            else if (currentZone.landArea > 0)
            {
                Debug.Log("Land mass is too low. New level being generated....");
            }
            else
            {
                Debug.Log("Underwater level detected. New level being generated....");
            }

            safety--;
            if (safety < 0)
            {
                break;
            }
        }

        currentZoneObjects = zoneRenderer.RenderZone(currentZone, zoneManager.regularTileSet);
        //zoneManager.Initialize(currentZone);
        //CapturePNG();
    }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZoneObjModel"/> class.
 /// </summary>
 /// <param name="renderer">Zone Primitive Renderer</param>
 public ZoneObjModel(ZoneRenderer renderer)
 {
     Renderer = renderer;
     Type     = ModelType.Visible;
 }
Пример #6
0
    void InitializeZone()
    {
        zoneManager = GameObject.FindWithTag("Zone Manager").GetComponent<ZoneManager>();
        zoneRenderer = zoneManager.GetComponent<ZoneRenderer>();

        // --- Input

        // --- Network

        // --- Zone
        if (currentZoneObjects != null && currentZoneObjects.Count > 0)
        {
          foreach (GameObject g in currentZoneObjects)
        Destroy (g);
        }
        int safety = 100;
        bool buildingZone = true;
        int minimumSize = 1750;

        Triangle tri = new Triangle(new Vector3(0, 0, 0), new Vector3(18, 0, 24), new Vector3(0, 0, 36));

        while (buildingZone)
        {
          currentZone = new Zone(tri);

          if (currentZone.landArea > minimumSize)
          {
        Debug.Log("Zone generated with a land mass of "+currentZone.landArea+" hex.");
        buildingZone = false;
          }
          else if (currentZone.landArea>0)
          {
        Debug.Log("Land mass is too low. New level being generated....");
          }
          else
          {
        Debug.Log("Underwater level detected. New level being generated....");
          }

          safety--;
          if (safety < 0)
        break;
        }

        currentZoneObjects = zoneRenderer.RenderZone(currentZone, zoneManager.regularTileSet);
        zoneManager.Initialize(currentZone);
    }
Пример #7
0
 private void OnDestroy()
 {
     ZoneRenderer.DestroyLoot(this);
 }
Пример #8
0
        public override void Leave(Zone zone)
        {
            var renderer = new ZoneRenderer(zone);

            contentIO.CreateOutputFile(renderer.GetPseudoInputFilePath(), renderer.GetOutputFileContents());
        }