<commit_before>/// <reference path="../../../../filePath.d.ts"/>
module dy {
    export abstract class FlyCameraControl {
        constructor(cameraComponent:Camera) {
            this.cameraComponent = cameraComponent;
        }

        public moveSpeed:number = 1.2;
        public rotateSpeed:number = 100;

        protected cameraComponent:Camera = null;

        private _rotateX:number = 0;
        private _rotateY:number = 0;
        private _isRotate:boolean = false;
        private _mouseDragSubscription:dyRt.IDisposable = null;
        private _keydownSubscription:dyRt.IDisposable = null;
        private _gameObject:GameObject = null;

        public init(gameObject:GameObject) {
            var self = this,
                eulerAngles = gameObject.transform.eulerAngles;

            this._rotateX = eulerAngles.x;
            this._rotateY = eulerAngles.y;

            this._gameObject = gameObject;

            this._bindCanvasEvent();
        }

        public update(time:number){
            if (!this._isRotate) {
                return;
            }

            this._isRotate = false;

            this._gameObject.transform.eulerAngles = Vector3.create(this._rotateX, this._rotateY, 0);
        }

        public dispose() {
            this._removeEvent();
        }

        protected abstract zoom(event:KeyboardEvent);

        private _move(event:KeyboardEvent) {
            var speed = this.moveSpeed,
                gameObject = this._gameObject,
                keyState = event.keyState;

            if (keyState["a"]) {
                gameObject.transform.translateLocal(Vector3.create(-speed, 0, 0));
            }
            else if(keyState["d"]) {
                gameObject.transform.translateLocal(Vector3.create(speed, 0, 0));
            }
            else if(keyState["w"]) {
                gameObject.transform.translateLocal(Vector3.create(0, 0, -speed));
            }
            else if(keyState["s"]) {
                gameObject.transform.translateLocal(Vector3.create(0, 0, speed));
            }
        }

        private _bindCanvasEvent() {
            var self = this,
                rotateSpeed = this.rotateSpeed,<commit_msg>FlyCameraControl add bind "up,right,down,left" arrow key to move<commit_after>/// <reference path="../../../../filePath.d.ts"/>
module dy {
    export abstract class FlyCameraControl {
        constructor(cameraComponent:Camera) {
            this.cameraComponent = cameraComponent;
        }

        public moveSpeed:number = 1.2;
        public rotateSpeed:number = 100;

        protected cameraComponent:Camera = null;

        private _rotateX:number = 0;
        private _rotateY:number = 0;
        private _isRotate:boolean = false;
        private _mouseDragSubscription:dyRt.IDisposable = null;
        private _keydownSubscription:dyRt.IDisposable = null;
        private _gameObject:GameObject = null;

        public init(gameObject:GameObject) {
            var eulerAngles = gameObject.transform.eulerAngles;

            this._rotateX = eulerAngles.x;
            this._rotateY = eulerAngles.y;

            this._gameObject = gameObject;

            this._bindCanvasEvent();
        }

        public update(time:number){
            if (!this._isRotate) {
                return;
            }

            this._isRotate = false;

            this._gameObject.transform.eulerAngles = Vector3.create(this._rotateX, this._rotateY, 0);
        }

        public dispose() {
            this._removeEvent();
        }

        protected abstract zoom(event:KeyboardEvent);

        private _move(event:KeyboardEvent) {
            var speed = this.moveSpeed,
                gameObject = this._gameObject,
                keyState = event.keyState;

            if (keyState["a"] || keyState["left"]) {
                gameObject.transform.translateLocal(Vector3.create(-speed, 0, 0));
            }
            else if(keyState["d"] || keyState["right"]) {
                gameObject.transform.translateLocal(Vector3.create(speed, 0, 0));
            }
            else if(keyState["w"] || keyState["up"]) {
                gameObject.transform.translateLocal(Vector3.create(0, 0, -speed));
            }
            else if(keyState["s"] || keyState["down"]) {
                gameObject.transform.translateLocal(Vector3.create(0, 0, speed));
            }
        }

        private _bindCanvasEvent() {
            var self = this,
                rotateSpeed = this.rotateSpeed,
{'fraction_non_alphanumeric': 0.10691264725494555, 'fraction_numerical': 0.009335407868415203, 'mean_word_length': 1.8571428571428572, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '673698', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1171, 'n_words': 220}