コード例 #1
0
ファイル: Camera.cs プロジェクト: nicolas-repiquet/Granite
        //public ILocated Target { get { return m_target.Target; } set { m_target.Target = value; } }
        public Camera()
        {
            m_location = new LocationComponent(this);
            //m_target = new FollowTargetComponent(this, m_location);
            m_lastInput = DateTime.Now;

            m_theta = 0;
            m_phi = 0;
            m_speed = 0.01;
            m_sensivity = 0.2;
        }
コード例 #2
0
        //public ILocated Target { get { return m_target.Target; } set { m_target.Target = value; } }

        public Camera()
        {
            m_location = new LocationComponent(this);
            //m_target = new FollowTargetComponent(this, m_location);
            m_lastInput = DateTime.Now;

            m_theta     = 0;
            m_phi       = 0;
            m_speed     = 0.01;
            m_sensivity = 0.2;
        }
コード例 #3
0
        private void Input(TimeSpan elapsed)
        {
            if ((DateTime.Now - m_lastInput).TotalMilliseconds > 100)
            {
                if (Engine.Keyboard.IsKeyPressed(Key.Left))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_left * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(-10, 0, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.Right))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_left * -1f * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(10, 0, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.Up))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_forward * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, 10, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.Down))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_forward * -1f * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, -10, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.P))
                {
                    //this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, 10));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, -10));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.M))
                {
                    //this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, -10));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, 10));
                }

                m_target = this.Location.Location.Position + m_forward;

                //VectorsFromAngles();
                m_lastInput = DateTime.Now;
            }
        }
コード例 #4
0
ファイル: Camera.cs プロジェクト: nicolas-repiquet/Granite
        private void Input(TimeSpan elapsed)
        {
            if ((DateTime.Now - m_lastInput).TotalMilliseconds > 100)
            {
                if (Engine.Keyboard.IsKeyPressed(Key.Left))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_left * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(-10, 0, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.Right))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_left * -1f * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(10, 0, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.Up))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_forward * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, 10, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.Down))
                {
                    //this.Location.Location = this.Location.Location.Translate(m_forward * -1f * (float)(m_speed  * elapsed.TotalMilliseconds));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, -10, 0));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.P))
                {
                    //this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, 10));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, -10));
                }

                if (Engine.Keyboard.IsKeyPressed(Key.M))
                {
                    //this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, -10));
                    this.Location.Location = this.Location.Location.Translate(new Vector3(0, 0, 10));
                }

                m_target = this.Location.Location.Position + m_forward;

                //VectorsFromAngles();
                m_lastInput = DateTime.Now;
            }
        }
コード例 #5
0
 public FollowTargetComponent(Entity entity, LocationComponent location)
     : base(entity)
 {
     m_location = location;
 }
コード例 #6
0
 public FollowTargetComponent(Entity entity, LocationComponent location)
     : base(entity)
 {
     m_location = location;
 }