Example #1
0
    private void Sinhro()
    {
        if (Input.GetButtonDown("Cancel"))
        {
            IMainMenu.ToMenu();
        }
        weapon.texture = (Texture)Resources.Load("Sprites/Weapon_" + player.savable.currentWeapon);
        if (fire)
        {
            Fire();
        }
        //SinhroCross ();
        Transform cm    = IHuman.cameraMainParent;
        Transform fp    = player.firePlace;
        float     speed = Time.deltaTime * 8;

        if (cross)
        {
            rangeView = 30;
            Vector3 v = fp.position - fp.forward + fp.up * 0.02f;
            Debug.DrawRay(v, fp.forward);
            cm.position = Vector3.Slerp(cm.position, v, speed);
        }
        else
        {
            rangeView        = 60;
            cm.localPosition = Vector3.Slerp(cm.localPosition, new Vector3(0, 0.0014f, 0.0013f), speed);
        }
        IHuman.cameraMain.fieldOfView = Mathf.Lerp(IHuman.cameraMain.fieldOfView, rangeView, 0.25f);
        health.text = "" + ((int)player.savable.health) + '\n' + "Зомби сейчас : " + DataCenter.dataCenter.zombies.Length;
        float  t   = ITimecycle.time;
        int    sec = (int)((t - (int)t) * 60);
        string s   = "" + sec;

        if (sec < 10)
        {
            s = "0" + sec;
        }
        killed.text = "Время : " + (int)t + ":" + s;
        IZombie z = IZombie.ZombieNearbyPosition(player.trans.position, 5, false);

        if (z)
        {
            Vector3 v = Vector0.Flat(z.trans.position - player.trans.position);
            v = player.trans.InverseTransformDirection(v);
            Quaternion q = Quaternion.LookRotation(v);
            zAngle = -135 - q.eulerAngles.y;
        }
        else
        {
            zAngle -= Time.deltaTime * 180;
        }
        radar.localEulerAngles = Vector3.forward * (zAngle);
        patronesType.texture   = (Texture)Resources.Load("Sprites/Patrones_" + player.savable.currentWeapon);
        patrones.text          = "" + player.savable.patrones_in [player.savable.currentWeapon] + "/" + player.savable.patrones_ [player.savable.currentWeapon];
    }