小编Adi*_*hal的帖子

将玩家的生活整合在一起

在我的游戏中有各种级别我在不同的场景中制作了这些级别每个场景都有一个玩家在起点,当它越过出口点时,下一个级别(下一个场景)被加载但健康和生命被重置为起点在游戏中并没有保持玩家退出关卡时目前拥有的东西

退出级别脚本: -

using UnityEngine;
using System.Collections;

public class ExitLevel : MonoBehaviour {

    public string scene;
    private Player player;



    // Use this for initialization
    void Start () {
        player = GameObject.Find ("Player").GetComponent<Player> ();
    }


    // Update is called once per frame
    void Update () {

    }

    void OnTriggerEnter2D(Collider2D target){

                        if (target.gameObject.tag == "Player") {
            if (player.ArtifactCount == 1) {
                player.ArtifactCount = 0;
                                Destroy (target.gameObject);
                                Application.LoadLevel (scene);
                        }
                }
    }
}
Run Code Online (Sandbox Code Playgroud)

LifeMeter脚本: -

using UnityEngine;
using System.Collections;

public class LifeMeter : …
Run Code Online (Sandbox Code Playgroud)

c# android unity-game-engine

0
推荐指数
1
解决办法
273
查看次数

标签 统计

android ×1

c# ×1

unity-game-engine ×1