Ejemplo n.º 1
0
        public override void Update(float elapsed)
        {
            for (int i = this.AlwaysUpdate.Count - 1; i >= 0; i--)
            {
                Component e = this.AlwaysUpdate[i];
                if (!e.Ghost)
                {
                    e.Update(elapsed);
                    if (e.Destroyed)
                    {
                        this.RemoveComponent(e);
                    }
                }
            }

            EntityRenderer r = this.renderer as EntityRenderer;

            if (r != null)
            {
                foreach (Entity e in this.integrator.GetEntitiesInRect(r.TopLeft, r.BottomRight, true))
                {
                    if (!e.Ghost && e.UpdateBehaviour == Entity.UpdateBehaviours.UpdateWhenVisible)
                    {
                        e.Update(elapsed);
                        if (e.Destroyed)
                        {
                            this.RemoveComponent(e);
                        }
                    }
                }
            }

            // DO NOT CALL BASE UPDATE! WE ARE OVERRIDING THIS BEHAVIOUR!!
            //base.Update(elapsed);
        }
Ejemplo n.º 2
0
        private void Init()
        {
            //TODO - just a test - WORKS!
            //_installedMods.Add(new TestMod());

            GlSetup();

            _itemRegistry   = new ItemRegistry();
            _blockRegistry  = new BlockRegistry();
            _recipeRegistry = new RecipeRegistry();

            LoadMods();

            GameRegistry();

            WorldRenderer  = new WorldRenderer();
            EntityRenderer = new EntityRenderer();
            GuiRenderer    = new GuiRenderer();
            FontRenderer   = new FontRenderer();

            SettingsManager.Load();

            //load settings
            Camera.SetTargetFov(SettingsManager.GetFloat("fov"));
            _sensitivity = SettingsManager.GetFloat("sensitivity");
            WorldRenderer.RenderDistance = SettingsManager.GetInt("renderdistance");

            OpenGuiScreen(new GuiScreenMainMenu());
        }
Ejemplo n.º 3
0
        public Player(MasterRenderer renderer, World world, SimpleCamera camera, Vector3 position, Team team)
            : base(position, 11, 5, 2.5f)
        {
            this.masterRenderer = renderer;
            this.World          = world;
            this.camera         = camera;
            Team = team;

            if (!GlobalNetwork.IsServer)
            {
                debugRenderer = renderer.GetRenderer3D <DebugRenderer>();
                entRenderer   = renderer.GetRenderer3D <EntityRenderer>();

                base.Renderer.VoxelObject = new DebugVOCube(world.GetTeamColor(team).ToColor4(), 1);

                flashlight = new Light(Vector3.Zero, LightType.Spot, 2, Color.White, new Vector3(1, 0, 0.002f))
                {
                    Radius = MathHelper.ToRadians(45), Visible = false
                };
                renderer.Lights.Add(flashlight);
            }

            HitFeedbackPositions = new List <Vector3>();

            Viewbob     = GlobalNetwork.IsClient ? new ItemViewbob(this) : null;
            ItemManager = new ItemManager(renderer, this, world, Viewbob);
        }
        public static List <EntityRenderer> LoadRenderers(List <string> filepaths)
        {
            CompilerResults       compilationResults = null;
            List <EntityRenderer> validRenders       = new List <EntityRenderer>();
            CodeDomProvider       codeProvider       = GetCodeDomProvider();

            try
            {
                CompilerParameters parms = GetParameters("Renders.dll");
                compilationResults = codeProvider.CompileAssemblyFromFile(parms, filepaths.ToArray());
                Assembly assembly = compilationResults.CompiledAssembly;
                foreach (var type in assembly.ExportedTypes)
                {
                    var rawResult = assembly.CreateInstance(type.ToString());
                    if (rawResult is EntityRenderer)
                    {
                        EntityRenderer result = (EntityRenderer)rawResult;
                        if (result != null)
                        {
                            validRenders.Add(result);
                        }
                    }
                }
                codeProvider.Dispose();
                return(validRenders);
            }
            catch (Exception ex)
            {
                InterpretException(ex, compilationResults, codeProvider);
                codeProvider.Dispose();
                return(validRenders);
            }
        }
Ejemplo n.º 5
0
        public EditorScreen(MainWindow window, MasterRenderer renderer)
        {
            this.Window     = window;
            this.renderer   = renderer;
            this.entReneder = renderer.GetRenderer3D <EntityRenderer>();

            UI = new EditorUI(renderer, this);

            debug = new DashCMDScreen("modeldebug", "", true, (s) =>
            {
                s.WriteLine("Mouse POS {0} {1}", Input.ClampedCursorX, Input.ClampedCursorY);
                s.WriteLine("Camera POS {0}", Camera.Active.Position);
                s.WriteLine("VoxelEditorObject POS {0}", (Model != null ? Model.CenterPosition : Vector3.Zero));
                s.WriteLine("");
                s.WriteLine("Current File {0}", CurrentFile);
                s.WriteLine("Fog: {0}; Enabled? {1}", renderer.GFXSettings.FogQuality, renderer.FogEnabled);
                s.WriteLine("FXAA: {0}", renderer.GFXSettings.ApplyFXAA);
                s.WriteLine("Shadows: {0}", renderer.GFXSettings.RenderShadows);
                s.WriteLine("PCF Samples: {0}", renderer.GFXSettings.ShadowPCFSamples);
                s.WriteLine("Wireframe: {0}", renderer.GlobalWireframe);
            })
            {
                SleepTime = 40,
            };

            DashCMD.AddScreen(debug);
            DashCMD.ExecuteCommand("screen modeldebug");

            Camera.Active.Speeds[0] = .5f;

            LoadNewModel();
        }
Ejemplo n.º 6
0
 protected override void DrawAdditionalContent( )
 {
     foreach (Mob mob in mobs)
     {
         EntityRenderer.Draw(mob, map.MobPosition);
     }
 }
Ejemplo n.º 7
0
        // These are special
        public void DrawOthers(DevicePanel d)
        {
            int x            = entity.Position.X.High;
            int y            = entity.Position.Y.High;
            int Transparency = (Editor.Instance.EditLayer == null) ? 0xff : 0x32;

            if (entity.Object.Name.Name.Contains("Setup"))
            {
                EntityRenderer renderer = EntityRenderers.Where(t => t.GetObjectName() == "ZoneSetup").FirstOrDefault();
                if (renderer != null)
                {
                    renderer.Draw(d, entity, this, x, y, Transparency);
                }
            }
            else if (entity.Object.Name.Name.Contains("Intro") || entity.Object.Name.Name.Contains("Outro"))
            {
                EntityRenderer renderer = EntityRenderers.Where(t => t.GetObjectName() == "Outro_Intro_Object").FirstOrDefault();
                if (renderer != null)
                {
                    renderer.Draw(d, entity, this, x, y, Transparency);
                }
            }
            else
            {
                EntityRenderer renderer = EntityRenderers.Where(t => t.GetObjectName() == entity.Object.Name.Name).FirstOrDefault();
                if (renderer != null)
                {
                    renderer.Draw(d, entity, this, x, y, Transparency);
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initialize any components required by this state.
        /// </summary>
        public override void Initialize()
        {
            ServiceManager.Game.FormManager.ClearWindow();
            Options options = ServiceManager.Game.Options;

            RendererAssetPool.DrawShadows = GraphicOptions.ShadowMaps;
            mouseCursor = new MouseCursor(options.KeySettings.Pointer);
            mouseCursor.EnableCustomCursor();
            renderer    = ServiceManager.Game.Renderer;
            fps         = new FrameCounter();
            Chat        = new ChatArea();
            Projectiles = new ProjectileManager();
            Tiles       = new TexturedTileGroupManager();
            Utilities   = new UtilityManager();
            cd          = new Countdown();
            Lazers      = new LazerBeamManager(this);
            Scene.Add(Lazers, 0);
            Players            = new PlayerManager();
            currentGameMode    = ServiceManager.Theater.GetCurrentGameMode();
            Flags              = new FlagManager();
            Bases              = new BaseManager();
            EnvironmentEffects = new EnvironmentEffectManager();
            buffbar            = new BuffBar();
            Scores             = new ScoreBoard(currentGameMode, Players);
            input              = new ChatInput(new Vector2(5, ServiceManager.Game.GraphicsDevice.Viewport.Height), 300);//300 is a magic number...Create a chat width variable.
            input.Visible      = false;
            hud              = HUD.GetHudForPlayer(Players.GetLocalPlayer());
            localPlayer      = Players.GetLocalPlayer();
            Scene.MainEntity = localPlayer;
            sky              = ServiceManager.Resources.GetTexture2D("textures\\misc\\background\\sky");
            tips             = new GameTips(new GameContext(CurrentGameMode, localPlayer));
            helpOverlay      = new HelpOverlay();
        }
Ejemplo n.º 9
0
        public ModelToTexture(Model _tank, Model _turret)
        {
            model1   = _tank;
            model2   = _turret;
            renderer = new EntityRenderer(ServiceManager.Game.GraphicsDeviceManager, ServiceManager.Game.Content);
            bak      = Renderer.GraphicOptions.BackgroundColor;

            //Set up the camera for the shot
            Camera cam = renderer.ActiveScene.CurrentCamera;

            renderer.ActiveScene.CreateCamera(new Vector3(100, 100, 20), Vector3.Zero, cam.Projection, "Side View");
            renderer.ActiveScene.AccessCamera("Side View").CameraUp = Vector3.UnitZ;
            renderer.ActiveScene.SwitchCamera("Side View");


            LoadContent();

            renderTarget = new RenderTarget2D(ServiceManager.Game.GraphicsDevice,
                                              ServiceManager.Game.GraphicsDeviceManager.PreferredBackBufferWidth,
                                              ServiceManager.Game.GraphicsDeviceManager.PreferredBackBufferHeight,
                                              1,
                                              SurfaceFormat.Color,
                                              ServiceManager.Game.GraphicsDevice.PresentationParameters.MultiSampleType,
                                              ServiceManager.Game.GraphicsDevice.PresentationParameters.MultiSampleQuality);
        }
Ejemplo n.º 10
0
        public ClientWorld(MasterRenderer renderer)
        {
            Renderer = renderer;

            debugRenderer = Renderer.GetRenderer3D <DebugRenderer>();
            entRenderer   = Renderer.GetRenderer3D <EntityRenderer>();
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     cBuilder = new ContentBuilder();
     Content.RootDirectory = cBuilder.OutputDirectory;
     renderer            = new EntityRenderer(graphics, Content);
     this.IsMouseVisible = true;
     base.Initialize();
 }
 public MasterRenderer()
 {
     GL.Enable(EnableCap.CullFace);
     GL.CullFace(CullFaceMode.Back);
     createProjectionMatrix();
     renderer = new EntityRenderer(shader,projectionMatrix);
     terrainRenderer = new TerrainRenderer(terrainShader, projectionMatrix);
 }
Ejemplo n.º 13
0
        // --------------------------------------------------------------------

        public EntityRendererInspectorControl(EntityRenderer renderer)
        {
            InitializeComponent();

            mRenderer = renderer;
            entityAssetField.AssetChanged += new EventHandler(OnEntitySelected);
            //materialAssetField.AssetChanged += new EventHandler(OnMaterialSelected);
        }
 private static void RenderEntities(GameEngine engine, GraphicsRenderer renderer, GameTime gameTime,
                                    List <CoreAbstractEntity> entities, ClientMapTile onTile, float tileDrawX, float tileDrawY)
 {
     foreach (CoreAbstractEntity entity in entities)
     {
         EntityRenderer entityRenderer = EntityRenderers.Get(entity);
         entityRenderer.Render(engine, renderer, gameTime, entity, onTile, tileDrawX, tileDrawY);
     }
 }
Ejemplo n.º 15
0
        public void AddEntity(Entity entity)
        {
            var entityRenderer = new EntityRenderer(_content, _expiringSpatialHash, entity, _tileSize.ToPoint());

            _expiringSpatialHash.AddNode(entity.Position.ToPoint(), entity);
            RenderList.Add(entityRenderer);
            EntityRenderersDict[entity] = entityRenderer;
            _spatialHashMover.Add(entity);
        }
Ejemplo n.º 16
0
        public void ExecuteInOutFilter(IFilter filter, Action <Entity> callbackIn, Action <Entity> callbackOut, FilterTarget target)
        {
            switch (target)
            {
            case FilterTarget.All:
                for (int i = 0; i < this.Components.Count; i++)
                {
                    if (this.Components[i] is Entity)
                    {
                        if (filter.Contains(this.Components[i] as Entity))
                        {
                            callbackIn(this.Components[i] as Entity);
                        }
                        else
                        {
                            callbackOut(this.Components[i] as Entity);
                        }
                    }
                }
                break;

            case FilterTarget.AlwaysUpdate:
                for (int i = 0; i < this.AlwaysUpdate.Count; i++)
                {
                    if (this.AlwaysUpdate[i] is Entity)
                    {
                        if (filter.Contains(this.AlwaysUpdate[i] as Entity))
                        {
                            callbackIn(this.AlwaysUpdate[i] as Entity);
                        }
                        else
                        {
                            callbackOut(this.AlwaysUpdate[i] as Entity);
                        }
                    }
                }
                break;

            case FilterTarget.OnScreen:
                EntityRenderer r = this.renderer as EntityRenderer;
                if (r != null)
                {
                    foreach (Entity e in this.integrator.GetEntitiesInRect(r.TopLeft, r.BottomRight, true))
                    {
                        if (filter.Contains(e))
                        {
                            callbackIn(e);
                        }
                        else
                        {
                            callbackOut(e);
                        }
                    }
                }
                break;
            }
        }
Ejemplo n.º 17
0
    protected new void Start()
    {
        base.Start();
        size = GetComponent <BoxCollider>().size.x;
        Rend = GetComponent <EntityRenderer>();

        boss     = GameObject.Find("BlackBishop(Clone)").GetComponent <BossBlackBishop>();
        Position = boss.addRocket(this);
        StartCoroutine("Wait");
    }
Ejemplo n.º 18
0
        public VoxelTranslationHandles(MasterRenderer renderer)
        {
            xAxisVo = new VoxelTranslationHandle(6, cubeSize, Color.Blue);
            xAxisVo.MeshRotation = new Vector3(0, 0, -90);
            yAxisVo = new VoxelTranslationHandle(6, cubeSize, Color.Red);
            zAxisVo = new VoxelTranslationHandle(6, cubeSize, Color.Green);
            zAxisVo.MeshRotation = new Vector3(90, 0, 0);

            entRenderer   = renderer.GetRenderer3D <EntityRenderer>();
            debugRenderer = renderer.GetRenderer3D <DebugRenderer>();
        }
Ejemplo n.º 19
0
        // --------------------------------------------------------------------

        public void SetEntity(int guid)
        {
            Entity e = OnyxInstance.Resources.GetEntity(guid);

            mProxy.EntityRef = e;

            EntityRenderer renderer = mProxy.GetComponent <EntityRenderer>();
            float          scale    = 1.25f / renderer.Bounds.Size.Max();

            mProxy.Transform.LocalScale = Vector3.One * scale;
        }
Ejemplo n.º 20
0
    /// <summary>
    /// Create a new renderer for the given entity
    /// </summary>
    /// <param name="entity">Entity for which the renderer will be created</param>
    private void CreateEntity(IMap map, Entity entity, bool isPlayer)
    {
        GameObject  instance = Instantiate(entityPrefab, Vector3.zero, Quaternion.identity);
        EntityActor actor    = instance.AddComponent(
            isPlayer ? typeof(PlayerActor) : typeof(AIActor)
            ) as EntityActor;

        actor.Init(map, entity);
        instance.transform.parent = transform;
        EntityRenderer renderer = instance.GetComponent <EntityRenderer>();

        renderer.Init(entity);
    }
Ejemplo n.º 21
0
        public Terrain(MasterRenderer renderer)
        {
            if (!GlobalNetwork.IsServer)
            {
                entRenderer     = renderer.GetRenderer3D <EntityRenderer>();
                chunkRenderer   = renderer.GetRenderer3D <ChunkRenderer>();
                MeshReadyChunks = new ConcurrentQueue <Chunk>();
            }

            Chunks     = new ConcurrentDictionary <IndexPosition, Chunk>();
            AllChanges = new List <BlockChange>();

            TrackChanges = GlobalNetwork.IsServer;
        }
Ejemplo n.º 22
0
        public void Draw(EntityRenderer entRenderer, ItemViewbob viewbob)
        {
            // Render item in hand
            if (SelectedItem != null)
            {
                if (SelectedItem.Type.HasFlag(ItemType.Gun))
                {
                    Gun gun = (Gun)SelectedItem;

                    // Render muzzle flash
                    ((ClientMuzzleFlash)muzzleFlash).Render(gun, entRenderer, viewbob);
                }

                SelectedItem.Draw(viewbob);
            }
        }
        public void Render(Gun gun, EntityRenderer entRenderer, ItemViewbob viewbob)
        {
            if (muzzleFlashTime > 0)
            {
                Matrix4 flashMatrix;

                if (ownerPlayer.IsRenderingThirdperson)
                {
                    flashMatrix =
                        Matrix4.CreateTranslation(gun.MuzzleFlashOffset)
                        * Matrix4.CreateScale(gun.ThirdpersonScale)
                        * Matrix4.CreateTranslation(0, 1.5f, -0.25f)
                        * Matrix4.CreateRotationZ(MathHelper.ToRadians(viewbob.CurrentTilt))
                        * Matrix4.CreateTranslation(gun.ModelOffset + viewbob.CurrentViewBob
                                                    + new Vector3(-1.35f, 0, -viewbob.CurrentKickback + -2))
                        * Matrix4.CreateRotationX(MathHelper.ToRadians(camera.Pitch))
                        * Matrix4.CreateRotationY(MathHelper.ToRadians(-camera.Yaw) - MathHelper.Pi)
                        * Matrix4.CreateTranslation(ownerPlayer.Transform.Position
                                                    + new Vector3(0, ownerPlayer.Size.Y / 2f - 1.5f, 0));
                }
                else
                {
                    flashMatrix =
                        Matrix4.CreateTranslation(gun.MuzzleFlashOffset)
                        * Matrix4.CreateRotationX(MathHelper.ToRadians(viewbob.CurrentSway.X))
                        * Matrix4.CreateRotationY(MathHelper.ToRadians(viewbob.CurrentSway.Y))
                        * Matrix4.CreateRotationZ(MathHelper.ToRadians(viewbob.CurrentTilt
                                                                       + viewbob.CurrentSway.Y * 0.5f))
                        * Matrix4.CreateTranslation(gun.ModelOffset + viewbob.CurrentViewBob
                                                    + new Vector3(0, 0, -viewbob.CurrentKickback))
                        * Matrix4.CreateRotationX(MathHelper.ToRadians(camera.Pitch))
                        * Matrix4.CreateRotationY(MathHelper.ToRadians(-camera.Yaw) - MathHelper.Pi)
                        * Matrix4.CreateTranslation(camera.OffsetPosition);
                }

                light.Position   = flashMatrix.ExtractTranslation();
                light.LightPower = (muzzleFlashTime / MUZZLE_FLASH_COOLDOWN) * MUZZLE_FLASH_LIGHT_POWER;

                flashCube.RenderFront = !ownerPlayer.IsRenderingThirdperson;
                entRenderer.Batch(flashCube, flashMatrix);
            }
            else
            {
                light.Visible = false;
            }
        }
Ejemplo n.º 24
0
    protected new void Start()
    {
        base.Start();
        Rend = GetComponent <EntityRenderer>();
        size = GetComponent <BoxCollider>().size.x;
        RectTransform TopPos    = GameObject.Find("Canvas/TopBackground").GetComponent <RectTransform>();
        RectTransform BottomPos = GameObject.Find("Canvas/ButtonBackground").GetComponent <RectTransform>();

        StopPosition = TopPos.position.y + BottomPos.position.y / 9 - boxCollider.size.y * 0.9f;
        if (Gm.WaveManager.EnemyMax < 6)
        {
            Gm.WaveManager.EnemyMax = 6;
        }
        LifeMax = Life;
        UpdateSpawnPosition();
        Gm.cm.BossMode = true;
    }
Ejemplo n.º 25
0
        public TerrainEditor(EditorScreen screen)
        {
            this.screen = screen;
            editor      = screen.WorldEditor;
            renderer    = screen.Window.Renderer;
            terrainPhys = new TerrainPhysicsExtension();
            entRenderer = renderer.GetRenderer3D <EntityRenderer>();
            colorPicker = screen.UI.ColorWindow.ColorPicker;

            blockCursorCube = new DebugCube(Color4.White, Block.CUBE_SIZE);
            SelectionBox    = new EditorSelectionBox();

            undoStack      = new Stack <TerrainOperationBatch>();
            redoStack      = new Stack <TerrainOperationBatch>();
            operationBatch = new TerrainOperationBatch();

            rayIntersection = new TerrainRaycastResult(new Ray(Vector3.Zero, Vector3.UnitZ));
        }
        private void ShowEntity(Entity e)
        {
            _selectionWindow.Hide();

            if (e != null)
            {
                if (_renderer != null)
                {
                    _renderer.Shutdown();
                }
                else
                {
                    _renderer                 = new EntityRenderer(e, World);
                    _renderer.Next.Click     += new EventHandler(Next_Click);
                    _renderer.Previous.Click += new EventHandler(Previous_Click);
                }
                _renderer.Update(e);
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Unload any content (textures, fonts, etc) used by this state. Called when the state is removed.
        /// </summary>
        public override void UnloadContent()
        {
            /*try
             * {
             *  ServiceManager.Game.GraphicsDevice.Reset();
             *  ServiceManager.Game.GraphicsDevice.VertexDeclaration = null;
             *  ServiceManager.Game.GraphicsDevice.Vertices[0].SetSource(null, 0, 0);
             * }
             * catch (Exception ex)
             * {
             *  // If the graphics device was disposed already, it throws an exception.
             *  Console.Error.WriteLine(ex);
             * }*/

            if (mouseCursor != null)
            {
                mouseCursor.DisableCustomCursor();
                mouseCursor = null;
            }
            EnvironmentEffects = null;
            Bases        = null;
            buffbar      = null;
            cd           = null;
            hud          = null;
            renderer     = null;
            fps          = null;
            map          = null;
            visibleTiles = null;
            Scores       = null;
            Players      = null;
            Projectiles  = null;
            Chat         = null;
            buffer       = null;
            miniMap.Dispose();
            miniMap = null;

            if (OnGameFinished != null)
            {
                EventArgs args = new EventArgs();
                OnGameFinished.Invoke(this, args);
            }
        }
Ejemplo n.º 28
0
        private void Init()
        {
            GlSetup();

            itemRegistry  = new ItemRegistry();
            blockRegistry = new BlockRegistry();

            WorldRenderer  = new WorldRenderer();
            EntityRenderer = new EntityRenderer();
            GuiRenderer    = new GuiRenderer();
            FontRenderer   = new FontRenderer();

            SettingsManager.Load();

            LoadMods();

            RegisterItemsAndBlocks();

            OpenGuiScreen(new GuiScreenMainMenu());
        }
Ejemplo n.º 29
0
    protected new void Start()
    {
        base.Start();
        r     = gameObject.GetComponent <EntityRenderer>();
        Speed = 0;
        //  RectTransform Width = GameObject.Find("Canvas/BackgroundImage").GetComponent<RectTransform>();
        RectTransform Canvas = GameObject.Find("Canvas").GetComponent <RectTransform>();

        totalSize = Screen.width * Canvas.localScale.x;
        updateRotateConst();
        float d = 0;

        for (int i = 0; i *verticalSpeed < 180; i++)
        {
            d += Mathf.Sin(Mathf.Deg2Rad * i * verticalSpeed);
        }
        boss         = GameObject.Find("BlackPawn(Clone)").GetComponent <BossBlackPawn>();
        stopPosition = boss.stopPosition + d / 2 * rotateConst;
        boss.addMinion(this);
    }
Ejemplo n.º 30
0
        public Spade(ItemManager itemManager, MasterRenderer renderer)
            : base(renderer, itemManager, ItemType.Spade)
        {
            ModelOffset = new Vector3(-3f, -5f, 3f);
            LoadModel("Models/spade.aosm");

            if (GlobalNetwork.IsClient)
            {
                entRenderer = renderer.GetRenderer3D <EntityRenderer>();

                if (cursorCube == null)
                {
                    cursorCube = new DebugCube(Color4.Black, Block.CUBE_SIZE);
                    cursorCube.RenderAsWireframe = true;
                    cursorCube.ApplyNoLighting   = true;
                    cursorCube.OnlyRenderFor     = RenderPass.Normal;
                }

                if (!itemManager.IsReplicated)
                {
                    AudioBuffer hitBlockAudioBuffer = AssetManager.LoadSound("Weapons/Spade/hit-block.wav");

                    if (hitBlockAudioBuffer != null)
                    {
                        hitBlockAudioSource = new AudioSource(hitBlockAudioBuffer);
                        hitBlockAudioSource.IsSourceRelative = true;
                        hitBlockAudioSource.Gain             = 0.2f;
                    }

                    AudioBuffer missAudioBuffer = AssetManager.LoadSound("Weapons/Spade/miss.wav");

                    if (missAudioBuffer != null)
                    {
                        missAudioSource = new AudioSource(missAudioBuffer);
                        missAudioSource.IsSourceRelative = true;
                        missAudioSource.Gain             = 0.5f;
                    }
                }
            }
        }
Ejemplo n.º 31
0
    private IEnumerator Run()
    {
        yield return(WaitForEndOfJob(new RandomizeJob(maxSize, positions)));

        EntityRenderer r = GetComponent <EntityRenderer>();

        for (;;)
        {
            if (Input.GetMouseButton(1))
            {
                yield return(WaitForEndOfJob(new SphereJob(maxSize, 0.01f, positions)));
            }
            else
            {
                yield return(null);
            }
            if (Input.GetMouseButton(0))
            {
                r.SetBuffer(this);
            }
        }
    }
Ejemplo n.º 32
0
		private void OnEnable () {
			renderer = (EntityRenderer)target;
			layerNames = GetSortingLayerNames ();
		}