示例#1
0
        private void GameCanvas_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (_grabbing)
                {
                    stopDragObject();
                    return;
                }

                if (MOUSE_PRESSED_LEFT)
                {
                    EndPointF = e.Location;

                    ActionTemplates.launch(
                        _physicsSystem,
                        ObjectTemplates.CreateSmallBall(StartPointF.X, StartPointF.Y),
                        StartPointF,
                        EndPointF);

                    MOUSE_PRESSED_LEFT = false;
                }
            }

            if (e.Button == MouseButtons.Right)
            {
                MOUSE_PRESSED_RIGHT = false;
            }
        }
示例#2
0
 void Start()
 {
     // itemTemplates contains all the different types of objects that can be spawned in a room
     objectTemplates = GameObject.FindGameObjectWithTag("RoomObjects").GetComponent <ObjectTemplates>();
     // Calls Spawn() every 0.1 seconds
     Invoke("Spawn", 0.1f);
 }
示例#3
0
        private void FormMainWindow_Load(object sender, EventArgs e)
        {
            ObjectTemplates.CreateWall(0, 0, 65, GameCanvas.Height);
            ObjectTemplates.CreateWall(GameCanvas.Width - 65, 0, GameCanvas.Width, GameCanvas.Height);
            ObjectTemplates.CreateWall(0, 0, GameCanvas.Width, 65);
            ObjectTemplates.CreateWall(0, GameCanvas.Height - 65, GameCanvas.Width, GameCanvas.Height);

            for (int i = 0; i < 400; i += 10)
            {
                for (int j = 0; j < 200; j += 10)
                {
                    ObjectTemplates.CreateSmallBall(i + 200, j + 150);
                }
            }

            ObjectTemplates.CreateAttractor(400, 450);
        }
示例#4
0
        private void FormMainWindow_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Space)
            {
                _physicsSystem.FreezeStaticObjects();
            }

            //Change to info Shader
            if (e.KeyCode == Keys.I)
            {
                ActionTemplates.changeShader(_physicsSystem, new ShaderInfo());
            }

            //Change to PoolBall
            if (e.KeyCode == Keys.P)
            {
                ActionTemplates.changeShader(_physicsSystem, new ShaderBall());
            }

            //Change to Water
            if (e.KeyCode == Keys.W)
            {
                ActionTemplates.changeShader(_physicsSystem, new ShaderWater());
            }

            //Change to Velocity Shader
            if (e.KeyCode == Keys.V)
            {
                ActionTemplates.changeShader(_physicsSystem, new ShaderBallVelocity());
            }

            //Create Gravity Ball
            if (e.KeyCode == Keys.G)
            {
                ObjectTemplates.CreateAttractor(_mousePos.X, _mousePos.Y);
            }

            //Pop
            if (e.KeyCode == Keys.OemSemicolon)
            {
                ActionTemplates.PopAndMultiply(_physicsSystem);
            }
        }
示例#5
0
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(4.0f));

        objectTemplates = GameObject.FindGameObjectWithTag("RoomObjects").GetComponent <ObjectTemplates>();
    }