Esempio n. 1
0
 // Token: 0x06000047 RID: 71 RVA: 0x00004C60 File Offset: 0x00002E60
 public virtual void LateUpdate()
 {
     if (this.target)
     {
         if (!this.targetBody)
         {
             this.targetBody = this.target;
         }
         if (Time.timeScale != (float)0)
         {
             this.x        += Input.GetAxis("Mouse X") * this.xSpeed * 0.02f;
             this.y        -= Input.GetAxis("Mouse Y") * this.ySpeed * 0.02f;
             this.distance -= Input.GetAxis("Mouse ScrollWheel") * Time.deltaTime * this.zoomRate * Mathf.Abs(this.distance);
             this.distance  = Mathf.Clamp(this.distance, this.minDistance, this.maxDistance);
             this.y         = ARPGcamera.ClampAngle(this.y, this.yMinLimit, this.yMaxLimit);
             Quaternion rotation = Quaternion.Euler(this.y, this.x, (float)0);
             this.transform.rotation = rotation;
             this.aim = Quaternion.Euler(this.y - this.aimAngle, this.x, (float)0);
             if (Input.GetButton("Fire1") || Input.GetButton("Fire2") || Input.GetAxis("Horizontal") != (float)0 || Input.GetAxis("Vertical") != (float)0 || this.lockOn)
             {
                 this.targetBody.transform.rotation = Quaternion.Euler((float)0, this.x, (float)0);
             }
             Vector3 position = this.target.position - (rotation * Vector3.forward * this.distance + new Vector3((float)0, -this.targetHeight, (float)0));
             this.transform.position = position;
             RaycastHit raycastHit = default(RaycastHit);
             Vector3    vector     = this.target.transform.position - new Vector3((float)0, -this.targetHeight, (float)0);
             if (Physics.Linecast(vector, this.transform.position, out raycastHit) && raycastHit.transform.tag == "Wall")
             {
                 float d = Vector3.Distance(vector, raycastHit.point) - 0.28f;
                 position = this.target.position - (rotation * Vector3.forward * d + new Vector3((float)0, -this.targetHeight, (float)0));
                 this.transform.position = position;
             }
         }
     }
 }
    // Token: 0x060001EA RID: 490 RVA: 0x00019068 File Offset: 0x00017268
    public virtual void Start()
    {
        GameObject gameObject = GameObject.FindWithTag("Player");

        if (gameObject)
        {
            string     spawnPointName = ((Status)gameObject.GetComponent(typeof(Status))).spawnPointName;
            GameObject gameObject2    = GameObject.Find(spawnPointName);
            if (gameObject2)
            {
                gameObject.transform.position = gameObject2.transform.position;
                gameObject.transform.rotation = gameObject2.transform.rotation;
            }
            GameObject gameObject3 = ((AttackTrigger)gameObject.GetComponent(typeof(AttackTrigger))).Maincam.gameObject;
            if (gameObject3)
            {
                GameObject[] array  = GameObject.FindGameObjectsWithTag("MainCamera");
                int          i      = 0;
                GameObject[] array2 = array;
                int          length = array2.Length;
                while (i < length)
                {
                    if (array2[i] != gameObject3)
                    {
                        UnityEngine.Object.Destroy(array2[i].gameObject);
                    }
                    i++;
                }
            }
        }
        else
        {
            GameObject gameObject4 = UnityEngine.Object.Instantiate <GameObject>(this.player, this.transform.position, this.transform.rotation);
            this.mainCam = GameObject.FindWithTag("MainCamera").transform;
            ARPGcamera exists = (ARPGcamera)this.mainCam.GetComponent(typeof(ARPGcamera));
            if (this.mainCam && exists)
            {
                ((ARPGcamera)this.mainCam.GetComponent(typeof(ARPGcamera))).target = gameObject4.transform;
            }
            Screen.lockCursor = true;
        }
    }
Esempio n. 3
0
    public void Awake()
    {
        this.gameObject.tag = "Player";
        if (!Maincam)
        {
            GameObject gameObject = GameObject.FindWithTag("MainCamera");
            if (!gameObject)
            {
                gameObject = UnityEngine.Object.Instantiate(MaincamPrefab, transform.position, transform.rotation);
            }
            Maincam = gameObject.transform;
        }
        if (!mainModel)
        {
            mainModel = this.gameObject;
        }
        ((Status)GetComponent(typeof(Status))).mainModel  = mainModel;
        ((Status)GetComponent(typeof(Status))).useMecanim = useMecanim;
        if ((bool)Maincam)
        {
            ARPGcamera exists = (ARPGcamera)Maincam.GetComponent(typeof(ARPGcamera));
            if (!exists)
            {
                UnityEngine.Object.Destroy(Maincam.gameObject);
                GameObject gameObject = UnityEngine.Object.Instantiate(MaincamPrefab, transform.position, transform.rotation);
                Maincam = gameObject.transform;
            }
        }
        else
        {
            GameObject gameObject = UnityEngine.Object.Instantiate(MaincamPrefab, transform.position, transform.rotation);
            Maincam = gameObject.transform;
        }
        if (!cameraZoomPoint || aimingType == AimType.Normal)
        {
            ((ARPGcamera)Maincam.GetComponent(typeof(ARPGcamera))).target = transform;
        }
        else
        {
            ((ARPGcamera)Maincam.GetComponent(typeof(ARPGcamera))).target = cameraZoomPoint;
        }
        ((ARPGcamera)Maincam.GetComponent(typeof(ARPGcamera))).targetBody = transform;
        str  = ((Status)GetComponent(typeof(Status))).addAtk;
        matk = ((Status)GetComponent(typeof(Status))).addMatk;
        int num = Extensions.get_length((System.Array)attackCombo);
        int i   = 0;

        if (num > 0 && !useMecanim)
        {
            for (; i < num && (bool)attackCombo[i]; i++)
            {
                mainModel.GetComponent <Animation>()[attackCombo[i].name].layer = 15;
            }
        }
        if (!attackPoint)
        {
            if (!attackPointPrefab)
            {
                MonoBehaviour.print("Please assign Attack Point");
                freeze = true;
                return;
            }
            GameObject gameObject2 = UnityEngine.Object.Instantiate(attackPointPrefab, transform.position, transform.rotation);
            gameObject2.transform.parent = transform;
            attackPoint = gameObject2.transform;
        }
        if (!useMecanim)
        {
            hurt = ((PlayerAnimation)GetComponent(typeof(PlayerAnimation))).hurt;
        }
        if (aimingType == AimType.Raycast)
        {
            ((ARPGcamera)Maincam.GetComponent(typeof(ARPGcamera))).lockOn = true;
        }
    }