示例#1
0
        public override void OnInit()
        {
            base.OnInit();

#if _REVIEW_DEBUG
            DebugObject = new DebugObject(LevelManager.Instance.CurrentLevel.DebugObject, Name, ReView.ReViewFeedObject.EDebugType.Track);

            binaryDataFeed = ReViewFeedManager.Instance.RegisterBinaryDataFeed();
            if (binaryDataFeed != null)
            {
                binaryDataFeed.OnDataReceived += OnDataReceived;
            }
#endif

            LevelManager.Instance.CreateComponent <Spatial>(this);
            LevelManager.Instance.CreateComponent <ActorDrawable>(this);

            LevelManager.Instance.CreateComponent <BehaviorSelector>(this);
            LevelManager.Instance.CreateComponent <SensorComponent>(this);

            Weapon = LevelManager.Instance.CreateGameObject <Weapon>("Weapon");
            Weapon.Spatial.Parent = Spatial;

            Respawn(0.0f);
        }
示例#2
0
        public static WorldObject CreateTestWorldObject(ushort weenieId)
        {
            var         aceObject = DatabaseManager.World.GetBaseAceObjectDataByWeenie(weenieId);
            WorldObject wo        = new DebugObject(new ObjectGuid(CommonObjectFactory.DynamicObjectId, GuidType.None), aceObject);

            return(wo);
        }
示例#3
0
        public override void OnInit()
        {
#if _REVIEW_DEBUG
            Actor actor = GameObject as Actor;
            DebugObject = new DebugObject(actor.DebugObject, "Behavior", ReView.ReViewFeedObject.EDebugType.Track);
#endif
        }
示例#4
0
        public virtual void OnInit()
        {
#if _REVIEW_DEBUG
            debugObject = new DebugObject(SelectorComponent.DebugObject, Name, ReView.ReViewFeedObject.EDebugType.Item);
            debugObject.Log("Starting " + Name + " behavior");
#endif
        }
 /// <summary>
 /// Overridden ProcessRecord method.
 /// </summary>
 protected override void ProcessRecord()
 {
     if (ContinueEvent != null)
     {
         DebugObject.Continue(ContinueEvent.ProcessId, ContinueEvent.ThreadId, ContinueStatus);
     }
     WriteObject(DebugObject.WaitForDebugEvent(Alertable, GetTimeout()));
 }
示例#6
0
        public override void OnInit()
        {
            perceptionFov      = 27.0f * SMath.DEG2RAD;
            perceptionDistance = 150.0f;

#if _REVIEW_DEBUG
            Actor actor = GameObject as Actor;
            DebugObject = new DebugObject(actor.DebugObject, "Sensor", ReView.ReViewFeedObject.EDebugType.Track);
#endif
        }
示例#7
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
 }
示例#8
0
        public static WorldObject CreateRandomTestWorldObject(uint typeId)
        {
            var aceObject = DatabaseManager.World.GetRandomBaseAceObjectByTypeId(typeId);

            if (aceObject == null)
            {
                return(null);
            }
            var wo = new DebugObject(new ObjectGuid(CommonObjectFactory.DynamicObjectId, GuidType.None), aceObject);

            return(wo);
        }
        /// <summary>
        /// Overridden ProcessRecord method.
        /// </summary>
        protected override void ProcessRecord()
        {
            switch (ParameterSetName)
            {
            case "DetachPid":
                DebugObject.Detach(ProcessId);
                break;

            case "DetachProcess":
                DebugObject.Detach(Process);
                break;
            }
        }
示例#10
0
    public void AddDebugObject(GameObject _obj, DebugMode?_mode)
    {
        DebugObject debugObj = new DebugObject();

        if (_mode != null)
        {
            debugObj.Set(_obj, _mode.Value);
        }
        else
        {
            debugObj.Set(_obj, DebugMode.noSelect);
        }
        debugObjList.Add(debugObj);
    }
示例#11
0
文件: Level.cs 项目: stallboy/ReView
        public override void OnInit()
        {
            base.OnInit();

#if _REVIEW_DEBUG
            DebugObject = new DebugObject(null, Name, ReView.ReViewFeedObject.EDebugType.Track);
#endif

            LevelManager.Instance.CurrentLevel = this;
            for (int k = 0; k < 5; k++)
            {
                string actorName = "Actor (" + k + ")";
                Actor  actor     = LevelManager.Instance.CreateGameObject <Actor>(actorName);
            }
        }
示例#12
0
        public override void onStart()
        {
            wall = Objects.getObject <Wall>("doorA");


            target = Objects.getObject <DebugObject>("phase2CameraSpot");

            camMaster = Objects.getObject <CameraMaster>("CameraMaster1");
            //camMaster.getScript("CameraMasterControl").Active = false;

            obj                     = new SimpleObject(Level);
            obj.Position            = Gob.Position;
            obj.Sprite.Color        = Color.Red;
            obj.Sprite.Visible      = false;
            camMaster.Target        = obj.Name;
            Level.Camera.TargetZoom = .2f;
            camMaster.ObeyCamZones  = false;
        }
示例#13
0
        public override void onStart()
        {
            //This code runs when the GameObject is initialized
            Wall wall = Objects.getObject <Wall>("WALLPIPE");

            wall.Active = false;
            wall.X      = 10100;

            target    = Objects.getObject <DebugObject>("Phase1CameraSpot");
            water     = Objects.getObject <WaterBlock>("WaterBlock1");
            camMaster = Objects.getObject <CameraMaster>("CameraMaster1");
            //camMaster.getScript("CameraMasterControl").Active = false;

            obj                     = new SimpleObject(Level);
            obj.Position            = Gob.Position;
            obj.Sprite.Color        = Color.Red;
            obj.Sprite.Visible      = false;
            camMaster.Target        = obj.Name;
            camMaster.ObeyCamZones  = false;
            Level.Camera.TargetZoom = .55f;
        }
示例#14
0
        public override void onUpdate()
        {
            if (target != null && obj != null)
            {
                Vector toTarget     = target.Position - obj.Position;
                Vector toTargetUnit = toTarget.UnitSafe;


                if (toTarget.Length < camSpeed * 15)
                {
                    Level.Camera.TargetZoom = .7f;
                }

                if (toTarget.Length + 1 > camSpeed)
                {
                    obj.Position += toTargetUnit * camSpeed;
                }
                else
                {
                    wall.Y = Math.Max(wall.Y - 5, 1200);

                    if (wall.Y < 1201 && phaseNum == 0)
                    {
                        target = Objects.getObject <DebugObject>("phase2CamSpotb");
                        Level.Camera.TargetZoom = .2f;
                        phaseNum++;
                        Objects.getObject <Wall>("Platform").Speed = 4;
                    }
                    else if (phaseNum == 1)
                    {
                        camMaster.Target = "Player";
                        Active           = false;
                        obj.close();
                        camMaster.ObeyCamZones = true;
                    }
                }
            }
        }
        public bool AddGameObjectIfCollidesWithMouse <T>(IList <T> collection) where T : GameObject
        {
            for (int i = 0; i < collection.Count; i++)
            {
                GameObject gameObj       = collection[i];
                Vector2    worldMousePos = Engine.Renderer.Camera.ScreenToWorld(Engine.InputManager.MousePosition);
                // Check if object collides with the mouse pointer
                if (CollisionUtils.PointIsInRectangleInclusive(worldMousePos, gameObj.ToRectangle()))
                {
                    // Check if an object with this Name already exists in DebugObjects
                    DebugObject debugObj = new DebugObject(gameObj);
                    if (DebugObjects.Find(o => o.Item.Name == gameObj.Name) == null)
                    {
                        // Add the object to DebugObjects
                        DebugObjects.Add(debugObj);
                        // Return true to signal that an object was added and the other calls can be skipped
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#16
0
文件: Debug.cs 项目: MaxPlay/Lemmings
        public static void DrawRectangle(Rectangle rect, Color color, FillMode mode)
        {
            DebugObject o = new DebugObject();

            o.Color = color;
            List <Rectangle> r = new List <Rectangle>();

            switch (mode)
            {
            case FillMode.Solid:
                r.Add(rect);
                break;

            case FillMode.WireFrame:
                r.Add(new Rectangle(rect.Left, rect.Top, rect.Width, 1));
                r.Add(new Rectangle(rect.Left, rect.Top, 1, rect.Height));
                r.Add(new Rectangle(rect.Left, rect.Bottom - 1, rect.Width, 1));
                r.Add(new Rectangle(rect.Right - 1, rect.Top, 1, rect.Height));
                break;
            }
            o.Rectangles = r.ToArray();
            objects.Add(o);
        }
示例#17
0
        public void DrawSuspensionDebugStuff(DeviceContextHolder holder, ICamera camera)
        {
            if (_suspensionLines == null)
            {
                _suspensionLines = new DebugLinesObject(Matrix.Identity, GetDebugSuspensionVertices(SuspensionsPack));
            }

            _suspensionLines.ParentMatrix = RootObject.Matrix;
            _suspensionLines.Draw(holder, camera, SpecialRenderMode.Simple);

            if (_wheelLfCon != default(Vector3))
            {
                if (_debugNode == null)
                {
                    _debugNode = new DebugObject(Matrix.Translation(_wheelLfCon), GeometryGenerator.CreateSphere(0.02f, 6, 6));
                }

                _debugNode.Transform    = Matrix.Translation(_wheelLfCon);
                _debugNode.ParentMatrix = RootObject.Matrix;

                holder.DeviceContext.OutputMerger.DepthStencilState = holder.States.DisabledDepthState;
                _debugNode.Draw(holder, camera, SpecialRenderMode.Simple);
            }
        }
示例#18
0
    void OnGUI()
    {
        root = EditorGUILayout.ObjectField("root", root, typeof(Transform), true) as Transform;

        GUILayout.Button("Debug");

        source = EditorGUILayout.ObjectField(source, typeof(GameObject), true) as GameObject;
        if (source != null)
        {
            DebugObject debugObject = new DebugObject();
            debugObject.debuggableObject = source;
            debuggableObjects.Add(debugObject);
            source = null;
        }

        for (int i = 0; i < debuggableObjects.Count; i++)
        {
            GameObject debuggableObject = debuggableObjects[i].debuggableObject;
            GUILayout.BeginVertical();
            debuggableObjects[i].collapse = EditorGUILayout.Foldout(debuggableObjects[i].collapse, "" + debuggableObject.name);

            if (GUILayout.Button("Remove"))
            {
                debuggableObjects.Remove(debuggableObjects[i]);
                continue;
            }

            GUILayout.EndVertical();
            if (debuggableObjects[i].collapse)
            {
                AddVariables(debuggableObject);
            }
        }
        GUILayout.Space(20);
        GUILayout.Button("Debug size " + debuggableObjects.Count);
    }
        public void Draw(RenderComposer composer)
        {
            foreach (Decoration bg in Backgrounds)
            {
                bg.Render(composer);
            }

            foreach (Decoration dec in BackgroundDecorations)
            {
                if (IsTransformOnSreen(dec))
                {
                    dec.Render(composer);
                }
            }

            foreach (Unit unit in Units)
            {
                if (IsTransformOnSreen(unit))
                {
                    unit.Render(composer);
                }
            }

            foreach (Collision.LineSegment plat in CollisionPlatforms)
            {
                plat.Render(composer);
            }

            // Draw Magic Flows
            foreach (MagicFlow mf in MagicFlows)
            {
                mf.Render(composer);
            }

            // Render Scene Changers
            for (int i = 0; i < SceneChangers.Count; i++)
            {
                SceneChangers[i].Render(composer);
            }

            // Render the player
            Player.Render(composer);

            foreach (Decoration dec in ForegroundDecorations)
            {
                if (IsTransformOnSreen(dec))
                {
                    dec.Render(composer);
                }
            }

            // Draw the room ceiling
            composer.RenderLine(new Vector3(0, 0, 15), new Vector3(LoadedRoom.Size.X, 0, 6), Color.Cyan, 1);

            // Draw camera position (probably the center of the screen)
            composer.RenderCircle(Engine.Renderer.Camera.Position, 1, Color.Cyan);

            // Display the current interaction
            if (CurrentInteration != null)
            {
                CurrentInteration.Render(composer);
            }

            // Draw DebugObjects' CollisionBoxes
            for (int i = 0; i < DebugObjects.Count; i++)
            {
                DebugObject debugObj = DebugObjects[i];
                debugObj.RenderObjectRectange(composer);
            }

            // Disabled the camera and draw on Screen Space instead of World Space
            composer.SetUseViewMatrix(false);

            // Draw DebugObjects
            for (int i = 0; i < DebugObjects.Count; i++)
            {
                DebugObject  debugObj             = DebugObjects[i];
                int          fontSize             = 18;
                float        debugObjDisplayWidth = debugObj.LongestLine.Length * 8; // Magic number
                TextureAsset textureAsset         = Engine.AssetLoader.Get <TextureAsset>("Textures/better-transparent-black.png");
                composer.RenderSprite(
                    new Vector3(debugObjDisplayWidth * i, 0, 15),
                    new Vector2(debugObjDisplayWidth, Engine.Configuration.RenderSize.Y),
                    Color.White,
                    textureAsset.Texture
                    );
                composer.RenderString(
                    new Vector3(debugObjDisplayWidth * i, 0, 15),
                    Color.Red,
                    debugObj.ToString(),
                    Engine.AssetLoader.Get <FontAsset>("Fonts/Calibri 400.ttf").GetAtlas(fontSize)
                    );
            }

            // Draw circle on mouse pointer
            composer.RenderCircle(new Vector3(Engine.InputManager.MousePosition, 15), 3, Color.Red, true);
            // Draw mouse coordinates
            composer.RenderString(
                new Vector3(20, Engine.Configuration.RenderSize.Y - 80, 15),
                Color.Red,
                Engine.InputManager.MousePosition.ToString(),
                Engine.AssetLoader.Get <FontAsset>("Fonts/Calibri 400.ttf").GetAtlas(18)
                );


            // Enable the camera again
            composer.SetUseViewMatrix(true);

            // Render the Emotion Tools UI
            //composer.RenderToolsMenu();
        }
示例#20
0
 public void AddObject(DebugObject obj)
 {
     Invalidated = true;
     Objects.Add(obj);
 }
 public void Ondebug(string message)
 {
     DebugObject.Log(message);
 }