Beispiel #1
0
        public GameRenderer()
        {
            this.shaderMan = new ShaderManager();
            var shaderLoader = ShaderFileLoader.CreateDefault("data/shaders");
            this.shaderMan.Add(shaderLoader.Load(""));

            this.surfaces = new SurfaceManager(this.shaderMan);

            new GeometryManager(this.surfaces);
        }
        /// <summary>
        /// The character has changed grounded states.
        /// </summary>
        /// <param name="grounded">Is the character on the ground?</param>
        private void OnGrounded(bool grounded)
        {
            if (grounded)
            {
                // Allow the SurfaceManager to play an effect when the character hits the ground.
                if (m_LandSurfaceImpact != null && m_CharacterLocomotion.LocalVelocity.y < m_MinSurfaceImpactVelocity)
                {
                    SurfaceManager.SpawnEffect(m_CharacterLocomotion.GroundRaycastHit, m_LandSurfaceImpact, m_CharacterLocomotion.GravityDirection, m_CharacterLocomotion.TimeScale, m_GameObject, m_Transform.forward, false);
                }

                // Move to the fall end state when the character lands.
                m_StateIndex = 1;
                if (!m_LandEvent.WaitForAnimationEvent)
                {
                    Scheduler.ScheduleFixed(m_LandEvent.Duration, Land);
                }
            }
            else
            {
                m_StateIndex = 0;
            }
        }
Beispiel #3
0
    private void OnPlacedBlock(PlacedBlock msg)
    {
        Point3 worldCoord = msg.worldCoord;
        Voxel  block      = ChunkManager.GetBlock(worldCoord);

        if (block == null)
        {
            block = ChunkManager
                    .AddChunk(worldCoord)
                    .AddBlock(worldCoord.ToLocalBlockCoord());
        }

        int hash = ChunkManager.GetHash(worldCoord.ToChunkCoord());

        block.SetBlockType(msg.type);

        // Get neighbours, pass to surface manager
        Voxel[] neighbours = GetNeighbours(worldCoord);

        // Lookup mesh name and rotation based on neighbours
        BlockInfo bi =
            SurfaceManager.GetSurface(
                SurfaceManager.GetID(neighbours));

        block.SetRotation(bi.rotation);

        for (int i = 0; i < neighbours.Length; i++)
        {
            if (neighbours[i] == null)
            {
                continue;
            }
            UpdateNeighbour(neighbours[i], worldCoord + checkSides[i]);
        }

        PlaceBlock(msg.worldCoord, hash, bi);
    }
Beispiel #4
0
        /// <summary>
        /// The character has changed grounded states.
        /// </summary>
        /// <param name="grounded">Is the character on the ground?</param>
        private void OnGrounded(bool grounded)
        {
            if (!IsActive)
            {
                return;
            }

            if (grounded)
            {
                SurfaceManager.SpawnEffect(m_CharacterLocomotion.GroundRaycastHit, m_GroundImpact, m_CharacterLocomotion.GravityDirection, m_CharacterLocomotion.TimeScale, m_GameObject);
                EventHandler.ExecuteEvent(m_GameObject, "OnAddSecondaryCameraForce", m_GroundPositionCameraRecoil.RandomValue, m_GroundRotationCameraRecoil.RandomValue, 0f);

                // The item may have completed its use before the object is grounded.
                if (CanStopAbility())
                {
                    StopAbility();
                }
                else
                {
                    m_UseOnGroundedSubstate = true;
                    m_CharacterLocomotion.UpdateItemAbilityAnimatorParameters();
                }
            }
        }
        public void SmoothAllSurfaces()
        {
            var surfaces = SurfaceManager.GetSurfacesList();

            foreach (var surface in surfaces)
            {
                try
                {
                    // Filter List

                    if (surface.Name.Contains("GREEN") ||
                        surface.Name.Contains("COLLAR") ||
                        surface.Name.Contains("BUNKER") ||
                        surface.Name.Contains("BRIDGE"))
                    {
                        SetSmoothing(surface);
                    }
                }
                catch (System.Exception ex)
                {
                    PGA.MessengerManager.MessengerManager.AddLog(String.Format("Smoothing All Region Failed {0}", ex));
                }
            }
        }
 /// <summary>
 /// Perform the impact action.
 /// </summary>
 /// <param name="castID">The ID of the cast.</param>
 /// <param name="source">The object that caused the cast.</param>
 /// <param name="target">The object that was hit by the cast.</param>
 /// <param name="hit">The raycast that caused the impact.</param>
 protected override void ImpactInternal(uint castID, GameObject source, GameObject target, RaycastHit hit)
 {
     SurfaceManager.SpawnEffect(hit, m_MagicItem.SurfaceImpact, m_CharacterLocomotion.Up, m_CharacterLocomotion.TimeScale, m_CharacterLocomotion.gameObject);
 }
Beispiel #7
0
        /// <summary>
        /// Encrypts all png graphics
        /// </summary>
        private static void DoGraphicConversions()
        {
            //if (IO.IO.FileExists("GFX\\Arrows.png")) {
            //    System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("Arrows.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("Arrows.png")));
            //    System.IO.File.Delete(IO.IO.GetGfxPath("Arrows.png"));
            //}
            //if (IO.IO.FileExists("GFX\\BigSpells.png")) {
            //    System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("BigSpells.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("BigSpells.png")));
            //    System.IO.File.Delete(IO.IO.GetGfxPath("BigSpells.png"));
            //}
            //if (IO.IO.FileExists("GFX\\BigSprites.png")) {
            //    System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("BigSprites0.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("BigSprites.png")));
            //    System.IO.File.Delete(IO.IO.GetGfxPath("BigSprites.png"));
            //}
            //if (IO.IO.FileExists("GFX\\Spells.png")) {
            //    System.IO.File.WriteAllBytes(IO.IO.GetGfxPath("Spells.pmugfx"), Graphics.SurfaceManager.EncryptSurface(IO.IO.GetGfxPath("Spells.png")));
            //    System.IO.File.Delete(IO.IO.GetGfxPath("Spells.png"));
            //}
            //for (int i = 0; i < Graphics.GraphicsManager.MAX_TILES; i++) {
            //    if (IO.IO.FileExists(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".png")) {
            //        System.IO.File.WriteAllBytes(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".pmugfx", Graphics.SurfaceManager.EncryptSurface(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".png"));
            //        System.IO.File.Delete(IO.Paths.GfxPath + "Tiles" + i.ToString() + ".png");
            //    }
            //}
            string[] files = System.IO.Directory.GetFiles(IO.Paths.GfxPath + "Sprites/", "*", SearchOption.TopDirectoryOnly);
            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].EndsWith(".png"))
                {
                    System.IO.File.WriteAllBytes(System.IO.Path.ChangeExtension(files[i], ".pmugfx"), Graphics.SurfaceManager.EncryptSurface(files[i]));
                    System.IO.File.Delete(files[i]);
                }
            }
            files = System.IO.Directory.GetFiles(IO.Paths.GfxPath + "Spells/", "*", SearchOption.TopDirectoryOnly);
            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].EndsWith(".png"))
                {
                    System.IO.File.WriteAllBytes(System.IO.Path.ChangeExtension(files[i], ".pmugfx"), Graphics.SurfaceManager.EncryptSurface(files[i]));
                    System.IO.File.Delete(files[i]);
                }
            }
            files = System.IO.Directory.GetFiles(IO.Paths.GfxPath + "Mugshots/", "*", SearchOption.TopDirectoryOnly);


            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].EndsWith(".png"))
                {
                    string path = System.IO.Path.GetDirectoryName(files[i]) + "/" + System.IO.Path.GetFileNameWithoutExtension(files[i]) + ".pmugfx";

                    SdlDotNet.Graphics.Surface mugshotSurface = new SdlDotNet.Graphics.Surface(files[i]);
                    mugshotSurface.ReplaceColor(Color.FromArgb(255, 254, 254, 254), Color.FromArgb(254, 254, 254, 254));
                    mugshotSurface.ReplaceColor(Color.FromArgb(255, 255, 255, 255), Color.FromArgb(254, 255, 255, 255));
                    SurfaceManager.SaveSurface(mugshotSurface, files[i]);

                    System.IO.File.WriteAllBytes(path, Graphics.SurfaceManager.EncryptSurface(files[i]));
                    System.IO.File.Delete(files[i]);
                }
            }
        }
Beispiel #8
0
        //- realy on SurfaceManager.ActiveDesignSurface
        //- which effectively points to ACTIVE DesignSurface
        public void ReloadComboBox()
        {
            _bSuppressEvents = true;
            try
            {
                //- IDesignerEventService provides a global eventing mechanism for designer events. With this mechanism,
                //- an application is informed when a designer becomes active. The service provides a collection of
                //- designers and a single place where global objects, such as the Properties window, can monitor selection
                //- change events.
                IDesignerEventService des = (IDesignerEventService)SurfaceManager.GetService(typeof(IDesignerEventService));
                if (null == des)
                {
                    return;
                }
                IDesignerHost host = des.ActiveDesigner;

                object selectedObj = pgrdPropertyGrid.SelectedObject;
                if (null == selectedObj)
                {
                    return; //- don't reload at all
                }
                //- get the name of the control selected from the comboBox
                //- and if we are not able to get it then it's better to exit
                string sName = string.Empty;
                if (selectedObj is ContainerControl)
                {
                    sName = ((ContainerControl)selectedObj).Name;
                }
                else if (selectedObj is Control)
                {
                    sName = ((Control)selectedObj).Site.Name;
                }
                if (string.IsNullOrEmpty(sName))
                {
                    return;
                }

                //- prepare the data for reloading the combobox (begin)
                List <object> ctrlsToAdd        = new List <object>();
                string        pgrdComboBox_Text = string.Empty;
                try
                {
                    ComponentCollection ctrlsExisting = host.Container.Components;
                    Debug.Assert(0 != ctrlsExisting.Count);

                    foreach (Component comp in ctrlsExisting)
                    {
                        string sItemText = TranslateComponentToName(comp);
                        ctrlsToAdd.Add(sItemText);
                        if (sName == comp.Site.Name)
                        {
                            pgrdComboBox_Text = sItemText;
                        }
                    }
                }
                catch (Exception)
                {
                    return; //- (rollback)
                }
                //- update the combobox (commit)
                pgrdComboBox.Items.Clear();
                pgrdComboBox.Items.AddRange(ctrlsToAdd.ToArray());
                pgrdComboBox.Text = pgrdComboBox_Text;
            }
            finally
            {
                _bSuppressEvents = false;
            }
        }
        //- realy on SurfaceManager.ActiveDesignSurface
        //- which effectively points to ACTIVE DesignSurface
        public void ReloadComboBox()
        {
            _bSuppressEvents = true;
            try {
                //- IDesignerEventService provides a global eventing mechanism for designer events. With this mechanism,
                //- an application is informed when a designer becomes active. The service provides a collection of
                //- designers and a single place where global objects, such as the Properties window, can monitor selection
                //- change events.
                IDesignerEventService des = (IDesignerEventService) SurfaceManager.GetService( typeof( IDesignerEventService ) );
                if( null == des )
                    return;
                IDesignerHost host = des.ActiveDesigner;

                object selectedObj = pgrdPropertyGrid.SelectedObject;
                if( null == selectedObj )
                    return; //- don't reload at all

                //- get the name of the control selected from the comboBox
                //- and if we are not able to get it then it's better to exit
                //string sName = string.Empty;
                //if( selectedObj is Form ) {
                //    sName = ((Form) selectedObj).Name;
                //}
                //else if( selectedObj is Control ) {
                //    sName = ((Control) selectedObj).Site.Name;
                //}
                //if( string.IsNullOrEmpty( sName ) )
                //    return;

                //- prepare the data for reloading the combobox (begin)
                List<object> ctrlsToAdd = new List<object>();
                object pgrdComboBox_Text = null;
                try
                {
                    ComponentCollection ctrlsExisting = null;
                    if (host.Container.Components.Count > 0 && host.Container.Components[0] is EbReportPanel)
                        ctrlsExisting = ((host.Container.Components[0] as EbReportPanel).ParentForm as ReportDesignerForm).DesignerCore.ActiveDesignSurface.ComponentContainer.Components;
                    //else if ((selectedObj is EbForm) && ((selectedObj as EbForm).Parent is EbReportPanel))
                    //    ctrlsExisting = (selectedObj as EbReportPanel).Container.Components;
                    else
                        ctrlsExisting = host.Container.Components;

                    //ComponentCollection ctrlsExisting = (selectedObj is EbReportPanel) ? (selectedObj as EbReportPanel).Container.Components : host.Container.Components;
                    Debug.Assert( 0 != ctrlsExisting.Count );

                    foreach( Component comp in ctrlsExisting ) {
                        //string sItemText = TranslateComponentToName( comp );
                        ctrlsToAdd.Add(comp);
                        if(selectedObj == comp)
                            pgrdComboBox_Text = comp;
                    }

                    
                }
                catch( Exception ) {
                    return; //- (rollback)
                }
                //- update the combobox (commit)
                pgrdComboBox.Items.Clear();
                    pgrdComboBox.Items.AddRange( ctrlsToAdd.ToArray() );
                    //pgrdComboBox.DataSource = ctrlsToAdd;
                    //pgrdComboBox.Update();
                pgrdComboBox.SelectedItem = pgrdComboBox_Text;
            }
            finally {
                _bSuppressEvents = false;
            }
        }
Beispiel #10
0
 private void OnDisable()
 {
     SurfaceManager.OnDisable();
 }
 public float GetSurfaceHeight(Vector3 position)
 {
     return(SurfaceManager.GetSurfaceHeight(position, height));
 }
Beispiel #12
0
        public override void WorldLoaded()
        {
            GetManager = Current.Game.GetComponent <SurfaceManager>();

            Current.Game.playSettings.useWorkPriorities = true;
        }
 /// <summary>
 /// Initializes the key timer.
 /// </summary>
 private void Start()
 {
     keyTimer       = new LimitTimerCallback(ChangeSetting, keyCooldown);
     surfaceManager = SurfaceManager.instance;
 }
 public static float WaterHeight(SurfaceManager manager)
 {
     return(manager.sea.transform.position.y);
 }
 void Awake()
 {
     singleton = this;
 }
Beispiel #16
0
 /// <summary>
 /// Initialize the surface manager reference.
 /// </summary>
 private void OnEnable()
 {
     m_SurfaceManager = target as SurfaceManager;
 }
Beispiel #17
0
 public RenderContext()
 {
     Surfaces   = new SurfaceManager();
     Geometries = new GeometryManager(Surfaces);
     Compositor = new FrameCompositor(Surfaces);
 }
Beispiel #18
0
        private void OnEnable()
        {
            hideFlags = HideFlags.DontUnloadUnusedAsset;

            SurfaceManager.OnEnable();
        }