Exemple #1
0
    public override void _Ready()
    {
        if (NX.IsUnderRoot(this))
        {
            //Load Game Scene
            GameScene = ResourceLoader.Load <PackedScene>(GameScenePath);

            //Instance game scene
            Node Game = GameScene.Instance();

            //Add to tree
            GetTree().Root.CallDeferred("add_child", Game);

            //Remove us from tree
            GetParent().CallDeferred("remove_child", this);

            //Add under Game node's 'CurrentLevel' and set owner
            Game.GetNode("CurrentLevel").CallDeferred("add_child", this);
            SetDeferred("owner", Game.GetNode("CurrentLevel"));

            Game.Set("current_level", this);
        }
        foreach (string path in HideNodes)
        {
            GetNode <Spatial>(path).Visible = false;
        }
    }
Exemple #2
0
 public override void _Ready()
 {
     base._Ready();
     LiftMesh        = GetNode <MeshInstance>(LiftMeshPath);
     PreviewMesh     = GetNode <MeshInstance>(PreviewMeshPath);
     CollisionShapes = NX.FindAll <CollisionShape>(Owner, true);
 }
Exemple #3
0
 public override void _Ready()
 {
     PlacementPreview = GetNode <KinematicBody>("PlacementPreview");
     PreviewMesh      = GetNode <MeshInstance>("PreviewMesh");
     PlacementArea    = NX.GetNodeWithNameType <Area>(PreviewMesh);
     PlacementArea.Connect("body_entered", this, "_OnAreaBodyEntered");
     PlacementArea.Connect("body_exited", this, "_OnAreaBodyExited");
     PreviewBoxShape = (BoxShape)NX.GetNodeWithNameType <CollisionShape>(PlacementPreview).Shape;
 }
Exemple #4
0
    private void _OnBodyExited(object body)
    {
        //Decrement number of bodies
        Bodies -= 1;

        //Search for GroundSound Node. If found, update sound library.
        GroundSound groundSound = NX.Find <GroundSound>((Node)body);

        if (groundSound != null && groundSound == OverlappedGroundSounds[groundSound.Priority])
        {
            OverlappedGroundSounds.Remove(groundSound.Priority);
            UpdateAudioPlayers();
        }
    }
Exemple #5
0
 bool WriteFromGRDECL(string file)
 {
     try
     {
         using (StreamWriter sw = new StreamWriter(file, true))
         {
             sw.WriteLine(string.Empty);
             sw.WriteLine(grdecl_kw_specgrid);
             sw.WriteLine(NX.ToString() + " " + NY.ToString() + " " + NZ.ToString() + " 1 F /");
             sw.WriteLine(string.Empty);
             sw.WriteLine("COORDSYS");
             sw.WriteLine("1 " + NZ + " /");
         }
     }
     catch (Exception)
     {
         Init();
         return(false);
     }
     return(true);
 }
Exemple #6
0
    private void _OnBodyEntered(object body)
    {
        //Increment number of bodies
        Bodies += 1;

        //Search for GroundSound Node. If found, update sound library.
        GroundSound groundSound = NX.Find <GroundSound>((Node)body);

        if (groundSound != null)
        {
            if (!OverlappedGroundSounds.ContainsKey(groundSound.Priority))
            {
                OverlappedGroundSounds.Add(groundSound.Priority, groundSound);
                UpdateAudioPlayers();
            }
            else
            {
                OverlappedGroundSounds[groundSound.Priority] = groundSound;
            }
        }
        //Allow character to bunny hop again
        CanBunnyHop = true;
    }
Exemple #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            ScreenWork();
            MessageBox.Show(SWH.ToString() + " " + SWW.ToString() + "\n" + NX.ToString() + " " + NY.ToString() + "\n" + PSH.ToString() + " " + PSW.ToString());



            int x = -SWW, y = 0;


            for (int i = 0; i < NY; i++)
            {
                for (int j = 0; j < NX; j++)
                {
                    Process P = Process.Start("notepad");
                    // Process P = Process.Start(S,"-File "+PS);

                    while (P.MainWindowHandle == IntPtr.Zero)
                    {
                        Application.DoEvents();
                    }

                    MoveWindow(P.MainWindowHandle, x + SWW, y, SWW, SWH, true);
                    SetWindowText(P.MainWindowHandle, "" + i + " " + j);
                    x += SWW;
                }
                x  = -SWW;
                y += SWH;
            }

            /*Process P1 = Process.Start("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe");
             * while (P1.MainWindowHandle == IntPtr.Zero)
             *  Application.DoEvents();
             *
             * MoveWindow(P1.MainWindowHandle, 201, 0, 200, 200, true);*/
        }
Exemple #8
0
    public override void _Ready()
    {
        _CollisionStand  = GetNode <CollisionShape>("CollisionStand");
        _CollisionCrouch = GetNode <CollisionShape>("CollisionCrouch");
        CapsuleShape shape1 = (CapsuleShape)_CollisionStand.Shape;
        CapsuleShape shape2 = (CapsuleShape)_CollisionCrouch.Shape;

        StandHeight    = shape1.Height;
        CrouchHeight   = shape2.Height;
        OtherCollision = NX.FindAll <CollisionShape>(this, true);
        OtherCollision.Remove(_CollisionStand);
        OtherCollision.Remove(_CollisionCrouch);

        StandArea       = GetNode <Area>("StandArea");
        Head            = GetNode <Spatial>("Head");
        Neck            = GetNode <Spatial>("Head/Wrapper1/Neck");
        _Camera         = GetNode <Camera>("Head/Wrapper1/Neck/Wrapper2/Wrapper3/Camera");
        HighlightCamera = GetNode <Camera>("Head/Wrapper1/Neck/Wrapper2/Wrapper3/Camera/Viewport2/Camera");
        ArmWrapper      = GetNode <Spatial>("Head/Wrapper1/Neck/Wrapper2/Wrapper3/Camera/Viewport/Wrapper4");
        ClimbTimer      = GetNode <Timer>("ClimbTimer");
        ClimbTimer.Connect("timeout", this, "_OnClimbTimerTimeout");

        //_JumpArea = GetNode<PlayerFeet>("JumpArea");
        _SnapArea = GetNode <SnapArea>("SnapArea");
        GroundRay = GetNode <RayCast>("GroundRay");
        LedgeRays = new RayCast[GetNode <Node>(("Head/LedgeRays")).GetChildCount()];
        for (int i = 0; i < LedgeRays.Length; ++i)
        {
            LedgeRays[i] = GetNode <RayCast>("Head/LedgeRays/LedgeRay" + (i + 1));
        }
        ClimbLabel = GetNode <Label>("UI/Reticle/ClimbLabel");
        JumpLabel  = GetNode <Label>("UI/JumpLabel");

        ScanRay           = GetNode <RayCast>("Head/Wrapper1/Neck/ScanRay");
        PointerProjectRay = GetNode <RayCast>("Head/Wrapper1/Neck/PointerProjectRay");
        ScanPlayer        = ScanRay.GetNode <AudioStreamPlayer>("Player");
        ScanTimer         = GetNode <Timer>("ScanTimer");
        ScanTimer.Connect("timeout", this, "_OnScanTimerTimeout");

        //Check for vital actions in InputMap
        IX.CheckAndAddAction("move_forward", KeyList.W);
        IX.CheckAndAddAction("move_backward", KeyList.S);
        IX.CheckAndAddAction("move_left", KeyList.A);
        IX.CheckAndAddAction("move_right", KeyList.D);
        IX.CheckAndAddAction("move_up", KeyList.E);
        IX.CheckAndAddAction("move_down", KeyList.Q);
        IX.CheckAndAddAction("toggle_fly", KeyList.V);
        IX.CheckAndAddAction("interact", KeyList.E);
        IX.CheckAndAddAction("drop", KeyList.R);
        IX.CheckAndAddAction("release_mouse", KeyList.F1, false, false, true);
        IX.CheckAndAddAction("place_debug_camera", KeyList.F2, false, false, true);

        Input.Singleton.Connect("joy_connection_changed", this, "_OnJoyConnectionChanged");

        MaxSlopeSlip   = Mathf.Deg2Rad(MaxSlopeSlip);
        MaxSlopeNoWalk = Mathf.Deg2Rad(MaxSlopeNoWalk);

        //Set jumps left
        JumpsLeft = JumpCount;

        //Set animation
        HeadBobbing = _headBobbing;
        SwingTarget = Vector2.Zero;

        //Capture mouse
        Input.SetMouseMode(Input.MouseMode.Captured);

        StandArea.Monitoring = true;
    }
Exemple #9
0
 private void _actionCenter_ReceivedCapture(int id, Image screenShot, NX.Hooks.HookEventArgs[] eventArgs)
 {
     string log = HookEventHelper.HookEventsToString(eventArgs);
     this._neuroLog.WriteFormat("Received Capture", "Image: {0}\n\nLog:\n{1}", screenShot != null ? "True" : "False", log);
     if (log != "")
         this.UpdateTerminal(this._tabClientPageIndices[id].CaptureLog, Color.YellowGreen, log);
     if (screenShot != null)
     {
         this._snapQueue.Enqueue(new TabImagePair(id, screenShot));
         this._neuroLog.Write("Start Screen Display Timer");
         this.StartScreenDisplayTimer();
     }
 }