public void snapShot2(int index)
    {
        Vector3    vector;
        RaycastHit hit;

        snapShotCamera.transform.position = head == null ? main_object.transform.position : head.transform.position;
        var transform = snapShotCamera.transform;

        transform.position += Vector3.up * heightMulti;
        var transform2 = snapShotCamera.transform;

        transform2.position -= Vector3.up * 1.1f;
        var worldPosition = vector = snapShotCamera.transform.position;
        var vector3       = (worldPosition + snapShotTargetPosition) * 0.5f;

        snapShotCamera.transform.position = vector3;
        worldPosition = vector3;
        snapShotCamera.transform.LookAt(snapShotTargetPosition);
        if (index == 3)
        {
            snapShotCamera.transform.RotateAround(this.transform.position, Vector3.up, Random.Range(-180f, 180f));
        }
        else
        {
            snapShotCamera.transform.RotateAround(this.transform.position, Vector3.up, Random.Range(-20f, 20f));
        }

        snapShotCamera.transform.LookAt(worldPosition);
        snapShotCamera.transform.RotateAround(worldPosition, this.transform.right, Random.Range(-20f, 20f));
        var num = Vector3.Distance(snapShotTargetPosition, vector);

        if (snapShotTarget != null && snapShotTarget.GetComponent <TITAN>() != null)
        {
            num += (index - 1) * snapShotTarget.transform.localScale.x * 10f;
        }

        var transform3 = snapShotCamera.transform;

        transform3.position -= snapShotCamera.transform.forward * Random.Range(num + 3f, num + 10f);
        snapShotCamera.transform.LookAt(worldPosition);
        snapShotCamera.transform.RotateAround(worldPosition, this.transform.forward, Random.Range(-30f, 30f));
        var end     = head == null ? main_object.transform.position : head.transform.position;
        var vector5 = (head == null ? main_object.transform.position : head.transform.position) - snapShotCamera.transform.position;

        end -= vector5;
        LayerMask mask  = 1 << LayerMask.NameToLayer("Ground");
        LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox");
        LayerMask mask3 = mask | mask2;

        if (head != null)
        {
            if (Physics.Linecast(head.transform.position, end, out hit, mask))
            {
                snapShotCamera.transform.position = hit.point;
            }
            else if (Physics.Linecast(head.transform.position - vector5 * distanceMulti * 3f, end, out hit, mask3))
            {
                snapShotCamera.transform.position = hit.point;
            }
        }
        else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hit, mask3))
        {
            snapShotCamera.transform.position = hit.point;
        }

        switch (index)
        {
        case 1:
            snapshot1 = RTImage(snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(snapshot1, snapShotDmg);
            break;

        case 2:
            snapshot2 = RTImage(snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(snapshot2, snapShotDmg);
            break;

        case 3:
            snapshot3 = RTImage(snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(snapshot3, snapShotDmg);
            break;
        }

        snapShotCount     = index;
        hasSnapShot       = true;
        snapShotCountDown = 2f;
        if (index == 1)
        {
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().mainTexture             = snapshot1;
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localScale    = new Vector3(Screen.width * 0.4f, Screen.height * 0.4f, 1f);
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localPosition = new Vector3(-Screen.width * 0.225f, Screen.height * 0.225f, 0f);
            GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.rotation      = Quaternion.Euler(0f, 0f, 10f);
            if (Settings.SnapshotsShowInGameSetting)
            {
                GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = true;
            }
            else
            {
                GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = false;
            }
        }
    }
Beispiel #2
0
    public void snapShot2(int index)
    {
        Vector3    vector;
        RaycastHit hit;

        this.snapShotCamera.transform.position = (this.head == null) ? this.main_object.transform.position : this.head.transform.position;
        Transform transform = this.snapShotCamera.transform;

        transform.position += (Vector3)(Vector3.up * this.heightMulti);
        Transform transform2 = this.snapShotCamera.transform;

        transform2.position -= (Vector3)(Vector3.up * 1.1f);
        Vector3 worldPosition = vector = this.snapShotCamera.transform.position;
        Vector3 vector5       = (Vector3)((worldPosition + this.snapShotTargetPosition) * 0.5f);

        this.snapShotCamera.transform.position = vector5;
        worldPosition = vector5;
        this.snapShotCamera.transform.LookAt(this.snapShotTargetPosition);
        if (index == 3)
        {
            this.snapShotCamera.transform.RotateAround(base.transform.position, Vector3.up, UnityEngine.Random.Range((float)-180f, (float)180f));
        }
        else
        {
            this.snapShotCamera.transform.RotateAround(base.transform.position, Vector3.up, UnityEngine.Random.Range((float)-20f, (float)20f));
        }
        this.snapShotCamera.transform.LookAt(worldPosition);
        this.snapShotCamera.transform.RotateAround(worldPosition, base.transform.right, UnityEngine.Random.Range((float)-20f, (float)20f));
        float num = Vector3.Distance(this.snapShotTargetPosition, vector);

        if ((this.snapShotTarget != null) && (this.snapShotTarget.GetComponent <TITAN>() != null))
        {
            num += ((index - 1) * this.snapShotTarget.transform.localScale.x) * 10f;
        }
        Transform transform3 = this.snapShotCamera.transform;

        transform3.position -= (Vector3)(this.snapShotCamera.transform.forward * UnityEngine.Random.Range((float)(num + 3f), (float)(num + 10f)));
        this.snapShotCamera.transform.LookAt(worldPosition);
        this.snapShotCamera.transform.RotateAround(worldPosition, base.transform.forward, UnityEngine.Random.Range((float)-30f, (float)30f));
        Vector3 end     = (this.head == null) ? this.main_object.transform.position : this.head.transform.position;
        Vector3 vector4 = ((this.head == null) ? this.main_object.transform.position : this.head.transform.position) - this.snapShotCamera.transform.position;

        end -= vector4;
        LayerMask mask  = ((int)1) << LayerMask.NameToLayer("Ground");
        LayerMask mask2 = ((int)1) << LayerMask.NameToLayer("EnemyBox");
        LayerMask mask3 = mask | mask2;

        if (this.head != null)
        {
            if (Physics.Linecast(this.head.transform.position, end, out hit, (int)mask))
            {
                this.snapShotCamera.transform.position = hit.point;
            }
            else if (Physics.Linecast(this.head.transform.position - ((Vector3)((vector4 * this.distanceMulti) * 3f)), end, out hit, (int)mask3))
            {
                this.snapShotCamera.transform.position = hit.point;
            }
        }
        else if (Physics.Linecast(this.main_object.transform.position + Vector3.up, end, out hit, (int)mask3))
        {
            this.snapShotCamera.transform.position = hit.point;
        }
        switch (index)
        {
        case 1:
            this.snapshot1 = this.RTImage(this.snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(this.snapshot1, this.snapShotDmg);
            break;

        case 2:
            this.snapshot2 = this.RTImage(this.snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(this.snapshot2, this.snapShotDmg);
            break;

        case 3:
            this.snapshot3 = this.RTImage(this.snapShotCamera.GetComponent <Camera>());
            SnapShotSaves.addIMG(this.snapshot3, this.snapShotDmg);
            break;
        }
        this.snapShotCount     = index;
        this.hasSnapShot       = true;
        this.snapShotCountDown = 2f;
        if (index == 1)
        {
            GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().mainTexture             = this.snapshot1;
            GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localScale    = new Vector3(Screen.width * 0.4f, Screen.height * 0.4f, 1f);
            GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localPosition = new Vector3(-Screen.width * 0.225f, Screen.height * 0.225f, 0f);
            GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.rotation      = Quaternion.Euler(0f, 0f, 10f);
            if (PlayerPrefs.HasKey("showSSInGame") && (PlayerPrefs.GetInt("showSSInGame") == 1))
            {
                GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = true;
            }
            else
            {
                GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = false;
            }
        }
    }
Beispiel #3
0
    public void snapShot2(int index)
    {
        uiTextSnap.enabled = false;
        Vector3    vector;
        RaycastHit hit;
        Transform  transform  = this.snapShotCamera.transform;
        Transform  transform2 = this.main_objectT;
        Transform  transform3 = this.head.transform;

        transform.position  = (this.head == null) ? transform2.position : transform3.position;
        transform.position += (Vector3)(Vector3.up * this.heightMulti);
        transform.position -= (Vector3)(Vector3.up * 1.1f);
        Vector3 worldPosition = vector = transform.position;
        Vector3 vector3       = (Vector3)((worldPosition + this.snapShotTargetPosition) * 0.5f);

        transform.position = vector3;
        worldPosition      = vector3;
        transform.LookAt(this.snapShotTargetPosition);
        if (index == 3)
        {
            transform.RotateAround(this.baseT.position, Vector3.up, UnityEngine.Random.Range((float)-180f, (float)180f));
        }
        else
        {
            transform.RotateAround(this.baseT.position, Vector3.up, UnityEngine.Random.Range((float)-20f, (float)20f));
        }
        transform.LookAt(worldPosition);
        transform.RotateAround(worldPosition, this.baseT.right, UnityEngine.Random.Range((float)-20f, (float)20f));
        float num = Vector3.Distance(this.snapShotTargetPosition, vector);

        if ((this.snapShotTarget != null) && (this.snapShotTarget.GetComponent <TITAN>() != null))
        {
            num += ((index - 1) * transform.localScale.x) * 10f;
        }
        transform.position -= (Vector3)(transform.forward * UnityEngine.Random.Range((float)(num + 3f), (float)(num + 10f)));
        transform.LookAt(worldPosition);
        transform.RotateAround(worldPosition, this.baseT.forward, UnityEngine.Random.Range((float)-30f, (float)30f));
        Vector3 end     = (this.head == null) ? transform2.position : transform3.position;
        Vector3 vector5 = ((this.head == null) ? transform2.position : transform3.position) - transform.position;

        end -= vector5;
        LayerMask mask  = ((int)1) << LayerMask.NameToLayer("Ground");
        LayerMask mask2 = ((int)1) << LayerMask.NameToLayer("EnemyBox");
        LayerMask mask3 = mask | mask2;

        if (this.head != null)
        {
            if (Physics.Linecast(transform3.position, end, out hit, (int)mask))
            {
                transform.position = hit.point;
            }
            else if (Physics.Linecast(transform3.position - ((Vector3)((vector5 * this.distanceMulti) * 3f)), end, out hit, (int)mask3))
            {
                transform.position = hit.point;
            }
        }
        else if (Physics.Linecast(transform2.position + Vector3.up, end, out hit, (int)mask3))
        {
            transform.position = hit.point;
        }
        Camera component = this.snapShotCamera.GetComponent <Camera>();

        switch (index)
        {
        case 1:
            this.snapshot1 = this.RTImage2(component);
            SnapShotSaves.addIMG(this.snapshot1, this.snapShotDmg);
            break;

        case 2:
            this.snapshot2 = this.RTImage2(component);
            SnapShotSaves.addIMG(this.snapshot2, this.snapShotDmg);
            break;

        case 3:
            this.snapshot3 = this.RTImage2(component);
            SnapShotSaves.addIMG(this.snapshot3, this.snapShotDmg);
            break;
        }
        this.snapShotCount     = index;
        this.hasSnapShot       = true;
        this.snapShotCountDown = 2f;
        if (index == 1)
        {
            uiTextSnap.mainTexture             = this.snapshot1;
            uiTextSnap.transform.localScale    = new Vector3(Screen.width * 0.4f, Screen.height * 0.4f, 1f);
            uiTextSnap.transform.localPosition = new Vector3(-Screen.width * 0.225f, Screen.height * 0.225f, 0f);
            uiTextSnap.transform.rotation      = Quaternion.Euler(0f, 0f, 10f);
        }
    }