Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考
此代码仅为较上一P有所改变的代码
【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili
GameData.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class GameData
{
public int currency;
public SerializableDictionary<string, bool> skillTree;
public SerializableDictionary<string, int> inventory;
public List<string> equipmentId;
public GameData()
{
this.currency = 0;
skillTree = new SerializableDictionary<string, bool>();
inventory = new SerializableDictionary<string, int>();
equipmentId = new List<string>();
}
}
Skill
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
public class Skill : MonoBehaviour
{
public float cooldown;
protected float cooldownTimer;
protected Player player;//拿到player
protected virtual void Start()
{
player = PlayerManager.instance.player;//拿到player
CheckUnlock();
}
protected virtual v