/// <summary>
        /// Updates the light and ambient variables which can then be used to update the shader.
        /// </summary>
        public void UpdateVars()
        {
            switch (type)
            {
            case RenderedObjectType.Terrain:
                TerrainModel terrain = (TerrainModel)modelObject.model;
                light          = ShaderIDTable.ALLOCATED_LIGHTS;
                renderDistance = float.MaxValue;
                break;

            case RenderedObjectType.Moby:
                Moby mob = (Moby)modelObject;
                light          = Math.Max(0, Math.Min(ShaderIDTable.ALLOCATED_LIGHTS, mob.light));
                ambient        = mob.color;
                renderDistance = mob.drawDistance;
                break;

            case RenderedObjectType.Tie:
                Tie tie = (Tie)modelObject;
                light          = Math.Max(0, Math.Min(ShaderIDTable.ALLOCATED_LIGHTS, tie.light));
                renderDistance = float.MaxValue;
                break;

            case RenderedObjectType.Shrub:
                Shrub shrub = (Shrub)modelObject;
                light          = Math.Max(0, Math.Min(ShaderIDTable.ALLOCATED_LIGHTS, shrub.light));
                ambient        = shrub.color;
                renderDistance = shrub.drawDistance;
                break;
            }
        }
Esempio n. 2
0
        public void CloneMoby(Moby moby)
        {
            if (!(moby.Clone() is Moby newMoby))
            {
                return;
            }

            level.mobs.Add(newMoby);
            SelectObject(newMoby);
            InvalidateView();
        }
Esempio n. 3
0
        public void LoadLevel(Level level)
        {
            this.level    = level;
            enableMoby    = true;
            enableTie     = true;
            enableShrub   = true;
            enableTerrain = true;

            Moby ratchet = level.mobs[0];

            camera.MoveBehind(ratchet);

            SelectObject(null);
            hook = new MemoryHook(level.game.num);
        }