Inheritance: MonoBehaviour
Example #1
0
    void Awake()
    {
        instance = this;

        _target = GameObject.FindGameObjectWithTag(Tags.PlayerTag);
        //_playerMovement = GetComponentInParent<Movement>();
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     _rb            = GetComponent <Rigidbody>();
     _playerMoved   = false;
     playerAnimator = GetComponent <Animator>();
     camera         = GetComponentInParent <CameraRotation>();
 }
 // Use this for initialization
 void Start()
 {
     cameraClick = GameObject.Find("Car Camera").GetComponent<CameraRotation>();
     turretPos = GameObject.Find("TurretPos");
     CubePos = GameObject.Find("CubePos");
     car = GameObject.Find("car");
     garageEnterLeaving = GameObject.Find("car").GetComponent<MakingCar>();
 }
Example #4
0
        public void CalculateXRotationShouldNotReturnAEulerAngleXGreaterThan90()
        {
            float          mouseY         = 1f;
            float          deltaTime      = -9.1f;
            CameraRotation CameraRotation = new CameraRotation(10f);

            Assert.LessOrEqual(CameraRotation.CalculateXRotation(mouseY, deltaTime).eulerAngles.x, 90);
        }
Example #5
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Khoi tao mang doi tuong moi
            drObj = new CDrawObject();
            listObjName.Clear();           // Xoa het cac doi tuong cu

            indexCurrentObj = -1;          // Bien giu index cua doi tuong nguoi dung chon
            currentColor    = Color.White; // Mau dung hien tai
            isChangedColor  = false;       // Su dung de doi mau obj khi da selected
            isAffine        = false;       // Bien kiem tra xem nguoi dung chon 1 trong cac affine
            pos             = new Point3D();
            rotation        = new Point3D();
            scale           = new Point3D();

            // Khoi tao doi tuong Camera
            cam = new CameraRotation();

            // Xoa listBox Sample Scene
            lstBox_SampleScene.Items.Clear();

            // Xoa cac bien ho tro affine
            listPos.Clear();
            listRota.Clear();
            listScale.Clear();

            // reset lai isTexture va path
            isTexture   = false;
            textureLink = "";

            // reset lai bien isDrawing
            isDrawing = true;

            // Gan tat cac textbox trong Transform ve gia tri mac dinh ban dau
            textBox_PosX.Text = "0";
            textBox_PosY.Text = "0";
            textBox_PosZ.Text = "0";

            textBox_RotateX.Text = "0";
            textBox_RotateY.Text = "0";
            textBox_RotateZ.Text = "0";

            textBox_ScaleX.Text = "1";
            textBox_ScaleY.Text = "1";
            textBox_ScaleZ.Text = "1";


            // Gan tat cac ca textbox cua cam ve gia tri mac dinh ban dau
            textBox_Cam_PosX.Text = "-4";
            textBox_Cam_PosX.Text = "0";
            textBox_Cam_PosX.Text = "-4";

            textBox_VpX.Text = "1";
            textBox_VpX.Text = "0";
            textBox_VpX.Text = "1";

            textBox_View.Text = "0";
        }
Example #6
0
        public void CalculateXRotationShouldReturnExpectedRotation()
        {
            float          mouseY         = 1f;
            float          deltaTime      = 1f;
            CameraRotation CameraRotation = new CameraRotation(10f);
            Quaternion     expected       = Quaternion.Euler(-10f, 0, 0);

            Assert.AreEqual(expected, CameraRotation.CalculateXRotation(mouseY, deltaTime));
        }
 void Awake()
 {
     camera    = GameObject.Find("Camera");
     player    = GameObject.Find("Player");
     cameraRot = camera.GetComponent <CameraRotation> ();
     playerPM  = player.GetComponent <PlayerMovement> ();
     X         = camera.transform.localEulerAngles.x;
     Y         = player.transform.localEulerAngles.y;
 }
Example #8
0
 public Camera(IMessenger messenger, CameraRotation rotation, CameraLookAt lookAt, CameraView view, BeatModifier beatModifier, double fov, double zoom)
 {
     Messenger    = messenger ?? throw new ArgumentNullException(nameof(messenger));
     Rotation     = rotation;
     LookAt       = lookAt;
     View         = view;
     BeatModifier = beatModifier ?? throw new ArgumentNullException(nameof(beatModifier));
     FOV          = fov;
     Zoom         = zoom;
 }
Example #9
0
    //initialization
    void Start()
    {
        //get cannon elements
        tip         = GameObject.Find("Tip");
        mesh        = GameObject.Find("Mesh");
        line        = GameObject.Find("CannonLine").GetComponent <LineRenderer>();
        audio       = GameObject.Find("AudioController").GetComponent <AudioController>();
        scorer      = GameObject.Find("UI").GetComponent <Scorekeeper>();
        camControls = GameObject.Find("Main Camera").GetComponent <CameraRotation>();
        camPosition = GameObject.Find("Main Camera").transform.position;
        camRotation = GameObject.Find("Main Camera").transform.rotation;

        //position elements according to master gameobject
        tip.transform.position = new Vector3(0, tipOffset, 0);
    }
Example #10
0
    public void Start()
    {
        if (isTransitionScene)
        {
            return;
        }

        playerObject = GameObject.FindGameObjectWithTag("Player");
        PlayerControl  playerControl  = playerObject.GetComponent <PlayerControl>();
        ScreenFade     screenFade     = GameObject.FindObjectOfType <ScreenFade>();
        CameraRotation cameraRotation = GameObject.FindObjectOfType <CameraRotation>();

        OnOutOfBounds.AddListener(screenFade.StartFadingProcess);
        OnOutOfBounds.AddListener(playerControl.SwitchToResetStart);
        OnOutOfBounds.AddListener(this.SwitchResetStateToLaunch);
        OnOutOfBounds.AddListener(cameraRotation.GetResetStart());
    }
Example #11
0
    public void Focus()
    {
        Focused = true;
        //Hands
        FP_Hands.SetActive(true);
        FP_Hands.transform.parent        = MainCamera.transform;
        FP_Hands.transform.localPosition = HandOffset;
        FP_Hands.transform.localRotation = Quaternion.identity;
        //Body
        setActiveBodyParts(false);
        //Camera
        MainCamera.transform.parent = transform;
        CameraRotation camRot = transform.parent.GetComponent <CameraRotation>();

        camRot.playerBody = transform.parent.gameObject;
        camRot.cameraObj  = MainCamera.gameObject;
        MainCamera.transform.localPosition = Vector3.zero;
    }
    IEnumerator PostCamera()
    {
        var camerapos = this.LoLCamera.transform.position;
        var camerarot = this.LoLCamera.transform.eulerAngles;

        CameraPosition cameraPosition = new CameraPosition();

        cameraPosition.x = camerapos.x;
        cameraPosition.y = camerapos.y;
        cameraPosition.z = camerapos.z;

        CameraRotation cameraRotation = new CameraRotation();

        cameraRotation.x = camerarot.y; // XとYが入れ替わっている
        cameraRotation.y = camerarot.x;
        cameraRotation.z = camerarot.z;

        string json = "{\"cameraPosition\":";

        json += JsonUtility.ToJson(cameraPosition);

        json += ",\"cameraRotation\":";
        json += JsonUtility.ToJson(cameraRotation);

        json += ",\"fieldOfView\":";
        json += LoLCamera.fieldOfView;

        json += ",\"cameraMode\":";
        json += "\"fps\"";

        json += "}";

        Debug.Log("RAW : " + cameraPosition);
        Debug.Log("JSON : " + json);
        WebClient webClient = new WebClient();

        webClient.Headers[HttpRequestHeader.ContentType] = "application/json;charset=UTF-8";
        webClient.Headers[HttpRequestHeader.Accept]      = "application/json";
        webClient.Encoding = Encoding.UTF8;
        string response = webClient.UploadString(new Uri(endpoint), json);

        yield return(0);
    }
Example #13
0
 public void StartMoving(PathNode node, CameraRotation camera, EnemySpawn spawner) {
     this.spawner = spawner;
     this.camera = camera;
     mStartMoving = true;
     mNode = node;
 }
Example #14
0
 // Use this for initialization
 void Start()
 {
     cameraClick = GameObject.Find("Main Camera").GetComponent<CameraRotation>();
     turretPos = GameObject.Find("TurretPos");
     CubePos = GameObject.Find("CubePos");
 }