资源简介

本人博客链接 https://blog.csdn.net/qwe25878/article/details/84955119

资源截图

代码片段和文件信息

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class JumpJump : MonoBehaviour
{
    //预制件
    public Gameobject seat;
    //最终压缩高度
    public float endscalcey = 0.5f;
    //很多的柱子
    private ArrayList seats;
    //主相机
    public Camera maincamera;
    //到哪个柱子了
    private Gameobject nowat;
    //是否可以跳跃
    private bool canjump = false;
    //按下的时长
    private float time = 0;
    //指示是否按下
    private bool ondown = false;
    //弹跳力
    public float jump = 1;
    //遮羞布
    public Gameobject plane;
    //是否运行在手机,如果运行手机,需要在检视面板中把他勾选上,然后再编译apk
    public bool onandriod = false;

    void Start()
    {
        seats = new ArrayList();
        seats.Add(Instantiate(seat new Vector3(0 0 0) Quaternion.identity));

        for (int i = 1; i < 20; i++)
        {
            seats.Add(Instantiate(seat new Vector3(Random.Range(1f 2.28f) + ((Gameobject)seats[i - 1]).transform.position.x 0 0) Quaternion.identity));
            ((Gameobject)seats[i]).transform.localScale = new Vector3(Random.Range(0.5f 1f) ((Gameobject)seats[i]).transform.localScale.y ((Gameobject)seats[i]).transform.localScale.z);
        }
    }

    void Update()
    {

        if (canjump && (Input.GetKey(KeyCode.Space) || Input.touchCount > 0))
        {
            var y = Mathf.SmoothStep(1 endscalcey time * 0.01f);
            nowat.transform.localScale = new Vector3(nowat.transform.localScale.x y nowat.transform.localScale.z);
            time += Time.timeScale;
            ondown = true;
            Debug.Log(“asd“);
            time = time > 100 ? 100 : time;
        }
        if (canjump && (Input.GetKeyUp(KeyCode.Space) || (onandriod && Input.touchCount == 0)) && ondown)
        {
            ondown = false;
            GetComponent().AddForce(new Vector3(time * jump 300 0));

            time = 0;
            nowat.transform.localScale = new Vector3(nowat.transform.localScale.x 1 nowat.transform.localScale.z);
        }

        if (transform.position.y < 0.2f)
        {
            SceneManager.LoadScene(“SampleScene“);
        }
    }

    private void LateUpdate()
    {
        Vector3 playerpos = transform.position;
        maincamera.transform.position = new Vector3(playerpos.x + 1.12f maincamera.transform.position.y maincamera.transform.position.z);
        plane.transform.position = new Vector3(playerpos.x + 1.12f plane.transform.position.y plane.transform.position.z);
        if (playerpos.x > ((Gameobject)seats[0]).transform.position.x + 6)
        {
            ((Gameobject)seats[0]).SetActive(false);
            Destroy(((Gameobject)seats[0]));
            seats.Remove(seats[0]);
            seats.Add(Instantiate(seat new Vector3(Random.Range(2f 5f) + ((Gameobject)seats[seats.Count - 1]).transform.position.x Random.Range(-1.09f 5.53f) -8.2f) Quaternion.identity));

        }

    }


    private void OnCollisionEnter(Collision collision)
    {
        nowat 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-12-11 13:50  JumpJump\
     目录           0  2018-12-11 13:50  JumpJump\obj\
     目录           0  2018-12-11 13:50  JumpJump\obj\Debug\
     文件      214972  2018-12-11 13:50  JumpJump\obj\Debug\Assembly-CSharp.csprojAssemblyReference.cache
     目录           0  2018-12-11 14:52  JumpJump\Temp\
     文件       19610  2018-12-11 11:26  JumpJump\Temp\UnityTempFile-dfdebc5c9cf7e4e36b3e754ded083d5a
     文件       11216  2018-12-11 13:49  JumpJump\Temp\UnityTempFile-be945c5b0b25a4dcd80199df00827774
     目录           0  2018-12-11 13:50  JumpJump\Temp\bin\
     目录           0  2018-12-11 13:50  JumpJump\Temp\bin\Debug\
     文件       11206  2018-12-11 13:50  JumpJump\Temp\UnityTempFile-b7fb51abe58214f509f5fb6847fdf013
     文件       11206  2018-12-11 14:45  JumpJump\Temp\UnityTempFile-d634e18d18515428999cd15c97bb63c4
     文件       18567  2018-12-11 13:50  JumpJump\Temp\UnityTempFile-925b08c57674f4ee6887ceb953e253d2
     文件           0  2018-12-11 11:26  JumpJump\Temp\UnityLockfile
     目录           0  2018-12-11 14:52  JumpJump\Temp\__Backupscenes\
     文件       20396  2018-12-11 14:52  JumpJump\Temp\__Backupscenes\0.backup
     文件       18898  2018-12-11 11:26  JumpJump\Temp\UnityTempFile-1e5b2a318b6604c078045e32189bfca9
     目录           0  2018-12-11 11:27  JumpJump\Temp\ProcessJobs\
     文件         100  2018-12-11 11:27  JumpJump\Temp\ProcessJobs\e4d7cdea9e7b674007a994e68f178ef6.bakert
     文件       11206  2018-12-11 13:58  JumpJump\Temp\UnityTempFile-2dab0e8ab1e42471883d47eaee3e5ad1
     文件       13330  2018-12-11 11:26  JumpJump\Temp\UnityTempFile-c21958907505845d2b3180c8a8298316
     文件       12999  2018-12-11 13:50  JumpJump\Temp\UnityTempFile-8b2d63a586ced4dddab09041a2862ad1
     文件       19279  2018-12-11 13:50  JumpJump\Temp\UnityTempFile-c62cb284428e94ee09cb456951157417
     文件       11206  2018-12-11 14:49  JumpJump\Temp\UnityTempFile-8762f7e12c5164941a821c2269872158
     文件       18345  2018-12-11 11:26  JumpJump\Temp\UnityTempFile-ccd0a23eabfab4c55a783400fbffec9e
     文件       18014  2018-12-11 13:50  JumpJump\Temp\UnityTempFile-47feae8ec61654ac7bc23174be22b617
     目录           0  2018-12-11 11:27  JumpJump\ProjectSettings\
     文件       18513  2018-12-11 11:27  JumpJump\ProjectSettings\ProjectSettings.asset
     文件        6088  2018-11-15 06:05  JumpJump\ProjectSettings\InputManager.asset
     文件         195  2018-11-15 06:05  JumpJump\ProjectSettings\TimeManager.asset
     文件        2283  2018-11-15 06:05  JumpJump\ProjectSettings\GraphicsSettings.asset
     文件         824  2018-11-15 06:05  JumpJump\ProjectSettings\PresetManager.asset
............此处省略1423个文件信息

评论

共有 条评论