• 大小: 19.79MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-19
  • 语言: 其他
  • 标签: 吃豆人  

资源简介

unity3d 5.3.1,吃豆人源码,亲测 可以运行,希望能帮到有用的人

资源截图

代码片段和文件信息

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

public class GameManager : MonoBehaviour
{
    private static GameManager _instance;
    public static GameManager Instance
    {
        get
        {
            return _instance;
        }
    }

    public Gameobject pacman;
    public Gameobject blinky;
    public Gameobject clyde;
    public Gameobject inky;
    public Gameobject pinky;
    public Gameobject startPanel;
    public Gameobject gamePanel;
    public Gameobject startCountDownPrefab;
    public Gameobject gameoverPrefab;
    public Gameobject winPrefab;
    public AudioClip startClip;
    public Text remainText;
    public Text nowText;
    public Text scoreText;

    public bool isSuperPacman = false;
    public List usingIndex = new List();
    public List rawIndex = new List { 0 1 2 3 };
    private Listject> pacdotGos = new Listject>();
    private int pacdotNum = 0;
    private int nowEat = 0;
    public int score = 0;

    private void Awake()
    {
        _instance = this;
        Screen.SetResolution(1024 768 false);
        int tempCount = rawIndex.Count;
        for (int i = 0; i < tempCount; i++)
        {
            int tempIndex = Random.Range(0 rawIndex.Count);
            usingIndex.Add(rawIndex[tempIndex]);
            rawIndex.RemoveAt(tempIndex);
        }
        foreach (Transform t in Gameobject.Find(“Maze“).transform)
        {
            pacdotGos.Add(t.gameobject);
        }
        pacdotNum = Gameobject.Find(“Maze“).transform.childCount;
    }

    private void Start()
    {
        SetGameState(false);
    }

    private void Update()
    {
        if (nowEat == pacdotNum && pacman.GetComponent().enabled != false)
        {
            gamePanel.SetActive(false);
            Instantiate(winPrefab);
            StopAllCoroutines();
            SetGameState(false);
        }
        if (nowEat == pacdotNum)
        {
            if (Input.anyKeyDown)
            {
                SceneManager.LoadScene(0);
            }
        }
        if (gamePanel.activeInHierarchy)
        {
            remainText.text = “Remain:\n\n“ + (pacdotNum - nowEat);
            nowText.text = “Eaten:\n\n“ + nowEat;
            scoreText.text = “Score:\n\n“ + score;
        }
    }

    public void onstartButton()
    {
        StartCoroutine(PlayStartCountDown());
        AudioSource.PlayClipAtPoint(startClip new Vector3(0 0 -5));
        startPanel.SetActive(false);
    }

    public void OnExitButton()
    {
        Application.Quit();
    }

    IEnumerator PlayStartCountDown()
    {
        Gameobject go = Instantiate(startCountDownPrefab);
        yield return new WaitForSeconds(4f);
        Destroy(go);
        SetGameState(true);
        Invoke(“CreateSuperPacdot“ 10f);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     64000  2018-03-01 18:25  Pacman\.vs\Pacman\v15\.suo

     文件          0  2017-12-27 16:55  Pacman\.vs\Pacman\v15\Server\sqlite3\db.lock

     文件     917504  2018-03-01 18:25  Pacman\.vs\Pacman\v15\Server\sqlite3\storage.ide

     文件        988  2017-12-27 20:31  Pacman\Assets\Animations\blinky.overrideController

    ..A..H.       230  2017-12-27 20:28  Pacman\Assets\Animations\blinky.overrideController.meta

     文件       1871  2017-12-27 20:25  Pacman\Assets\Animations\blinkyDown.anim

    ..A..H.       229  2017-12-27 20:21  Pacman\Assets\Animations\blinkyDown.anim.meta

     文件       1871  2017-12-27 20:25  Pacman\Assets\Animations\blinkyLeft.anim

    ..A..H.       229  2017-12-27 20:20  Pacman\Assets\Animations\blinkyLeft.anim.meta

     文件       1872  2017-12-27 20:25  Pacman\Assets\Animations\blinkyRight.anim

    ..A..H.       229  2017-12-27 20:20  Pacman\Assets\Animations\blinkyRight.anim.meta

     文件       1869  2017-12-27 20:25  Pacman\Assets\Animations\blinkyUp.anim

    ..A..H.       229  2017-12-27 20:20  Pacman\Assets\Animations\blinkyUp.anim.meta

     文件        987  2017-12-27 20:31  Pacman\Assets\Animations\Clyde.overrideController

    ..A..H.       230  2017-12-27 20:30  Pacman\Assets\Animations\Clyde.overrideController.meta

     文件       1870  2017-12-27 20:25  Pacman\Assets\Animations\ClydeDown.anim

    ..A..H.       229  2017-12-27 20:22  Pacman\Assets\Animations\ClydeDown.anim.meta

     文件       1870  2017-12-27 20:25  Pacman\Assets\Animations\ClydeLeft.anim

    ..A..H.       229  2017-12-27 20:21  Pacman\Assets\Animations\ClydeLeft.anim.meta

     文件       1871  2017-12-27 20:25  Pacman\Assets\Animations\ClydeRight.anim

    ..A..H.       229  2017-12-27 20:21  Pacman\Assets\Animations\ClydeRight.anim.meta

     文件       1868  2017-12-27 20:25  Pacman\Assets\Animations\ClydeUp.anim

    ..A..H.       229  2017-12-27 20:22  Pacman\Assets\Animations\ClydeUp.anim.meta

     文件        986  2017-12-27 20:31  Pacman\Assets\Animations\Inky.overrideController

    ..A..H.       230  2017-12-27 20:30  Pacman\Assets\Animations\Inky.overrideController.meta

     文件       1869  2017-12-27 20:25  Pacman\Assets\Animations\InkyDown.anim

    ..A..H.       229  2017-12-27 20:23  Pacman\Assets\Animations\InkyDown.anim.meta

     文件       1869  2017-12-27 20:25  Pacman\Assets\Animations\InkyLeft.anim

    ..A..H.       229  2017-12-27 20:22  Pacman\Assets\Animations\InkyLeft.anim.meta

     文件       1870  2017-12-27 20:25  Pacman\Assets\Animations\InkyRight.anim

............此处省略1335个文件信息

评论

共有 条评论