} // 存储商店售卖哪些道具 public GameData() { //构造函数,设置默认存档 key = SystemInfo.deviceUniqueIdentifier; //设定密钥,根据具体平台设定// // Player Name = "我"; Rank = 1; Gold = 100; // 【以后需要删掉】 CanAvoid = true; CanAttack2 = true; CanAttack3 = true; CanDush = true; // 【以后需要删掉】 // 初始装备 Fit = new IEquip[6]; Fit[(int)FitType.Weapon] = UnityHelper.FindDic(GameMainProgram.Instance.dataBaseMgr.dicEquip, "太刀"); // 初始背包,1~31值为-1 PropNum = new int[32]; for (int i = 1; i < 32; i++) { PropNum[i] = -1; } PropNum[0] = 3; MedicineID = 0; // 其他 HasProp = new bool[32]; HasProp[0] = true; HasProp[1] = true; }
private void ChangeEquip_aux(IEquip _dropEquip, IEquip _dressOnEquip) { // 无论是否有装备可以卸下都可以穿上新装备 if (_dropEquip != null) { Enemy.MoveSpeed -= _dropEquip.Speed; Enemy.MaxHP -= _dropEquip.HP; Enemy.MaxSP -= _dropEquip.SP; Enemy.AttackPoint -= _dropEquip.Attack; Enemy.DefendPoint -= _dropEquip.Defend; Enemy.CritPoint -= _dropEquip.Crit; if (_dropEquip.Type == FitType.Weapon) { Enemy.Special = SpecialAbility.无; } } Enemy.MoveSpeed += _dressOnEquip.Speed; Enemy.MaxHP += _dressOnEquip.HP; Enemy.MaxSP += _dressOnEquip.SP; Enemy.AttackPoint += _dressOnEquip.Attack; Enemy.DefendPoint += _dressOnEquip.Defend; Enemy.CritPoint += _dressOnEquip.Crit; if (_dressOnEquip.Type == FitType.Weapon) { Enemy.Special = _dressOnEquip.Special; } // 更新完Player的属性后更新WeaponMono的属性 UpdateEnemyWeapon(EnemyWeapon); }
public GameData() { // 构造函数,设置默认存档 key = SystemInfo.deviceUniqueIdentifier; // 设定密钥,根据具体平台设定 HP = 100; // Player Fit = UnityHelper.FindDic(GameMainProgram.Instance.dataBaseMgr.equipDict, "步枪"); }
/// <summary> /// 改变WeaponData,更新Player属性,更新WeaponMono属性 /// </summary> /// <param name="_equipData"></param> public void ChangeEquip(IEquip _equipData) { if (_equipData == null) { Debug.LogError("_equipData为空!"); return; } // 切换不同的装备 DressOnEquip(_equipData); }
/// <summary> /// 穿上装备 /// </summary> /// <param name="equip"></param> private void Equip(IEquip equip) { Player.MaxHP += equip.HP; Player.MaxSP += equip.SP; PlayerWeapon.BasicAttack += equip.Attack; if (equip.Type == FitType.Weapon) { PlayerWeapon.CilpBulletCount = equip.CilpBulletCount; PlayerWeapon.CurrentBulletCount = equip.CilpBulletCount; PlayerWeapon.RemainingBulletCount = equip.TotalBulletCount - equip.CilpBulletCount; } }
public void Equip(IEquip equip) { Enemy.MaxHP += equip.HP; Enemy.MaxSP += equip.SP; EnemyWeapon.BasicAttack += equip.Attack; if (equip.Type == FitType.Weapon) { EnemyWeapon.CilpBulletCount = equip.CilpBulletCount; EnemyWeapon.CurrentBulletCount = equip.CilpBulletCount; EnemyWeapon.RemainingBulletCount = equip.TotalBulletCount - equip.CilpBulletCount; } }
public void DressOnEquip(IEquip _dressOnEquip) { Player.MoveSpeed += _dressOnEquip.Speed / 10; Player.MaxHP += _dressOnEquip.HP; Player.MaxSP += _dressOnEquip.SP; Player.AttackPoint += _dressOnEquip.Attack; Player.DefendPoint += _dressOnEquip.Defend; Player.CritPoint += _dressOnEquip.Crit; if (_dressOnEquip.Type == FitType.Weapon) { Player.Special = _dressOnEquip.Special; } }
/// <summary> /// Initialize只在第一次创建时执行初始化代码,之后切换Scene时都不用再次初始化,所以Data也没有改变 /// </summary> /// <param name="gameObject"></param> public IPlayer(GameObject gameObject) : base(gameObject) { Speed = 5; Fits = new IEquip[6]; if (GameObjectInScene != null) { animator = GameObjectInScene.GetComponent <Animator>(); Rgbd = GameObjectInScene.GetComponent <Rigidbody>(); // 关联中介者 PlayerMedi = new PlayerMediator(this); PlayerMedi.Initialize(); } }
/// <summary> /// 添加背包中的装备 /// </summary> public bool AddItem(IEquip _Equip) { int i = 0; while (EquipPack[i] != null) // 找到一个空位 { i++; } if (i >= EquipPack.Length) { return(false); } EquipPack[i] = _Equip; return(true); }
private void DressOnEquip(IEquip _dressOnEquip) { // 无论是否有装备可以卸下都可以穿上新装备 Enemy.MoveSpeed += _dressOnEquip.Speed; Enemy.MaxHP += _dressOnEquip.HP; Enemy.MaxSP += _dressOnEquip.SP; Enemy.AttackPoint += _dressOnEquip.Attack; Enemy.DefendPoint += _dressOnEquip.Defend; Enemy.CritPoint += _dressOnEquip.Crit; if (_dressOnEquip.Type == FitType.Weapon) { Enemy.Special = _dressOnEquip.Special; } // 更新完Player的属性后更新WeaponMono的属性 UpdateEnemyWeapon(EnemyWeapon); }
public void DropEquip(IEquip _dropEquip) { if (_dropEquip != null) { Player.MoveSpeed -= _dropEquip.Speed / 10; Player.MaxHP -= _dropEquip.HP; Player.MaxSP -= _dropEquip.SP; Player.AttackPoint -= _dropEquip.Attack; Player.DefendPoint -= _dropEquip.Defend; Player.CritPoint -= _dropEquip.Crit; if (_dropEquip.Type == FitType.Weapon) { Player.Special = SpecialAbility.无; } Player.Fit[(int)_dropEquip.Type] = 99; } }
/// <summary> /// Initialize只在第一次创建时执行初始化代码,之后切换Scene时都不用再次初始化,所以Data也没有改变 /// </summary> /// <param name="gameObject"></param> public IPlayer(GameObject gameObject) : base(gameObject) { EquipPack = new IEquip[35]; PropPack = new IProp[35]; Fit = new int[8] { 99, 99, 99, 99, 99, 99, 99, 99 }; // 初始值>34表示未装备 if (GameObjectInScene != null) { animator = GameObjectInScene.GetComponent <Animator>(); Rgbd = GameObjectInScene.GetComponent <Rigidbody>(); // 关联中介者 PlayerMedi = new PlayerMediator(this); PlayerMedi.Initialize(); } // LoadData(); 请在子类构造函数最尾处调用 }
/// <summary> /// 改变WeaponData,更新Player属性,更新WeaponMono属性 /// </summary> /// <param name="_equipData"></param> public void ChangeEquip(IEquip _equipData) { if (_equipData == null) { Debug.Log("_equipData为空!"); return; } // 切换不同的装备 switch (_equipData.Type) { case FitType.Weapon: ChangeEquip_aux(WeaponData, _equipData); break; case FitType.Cloth: ChangeEquip_aux(ClothData, _equipData); break; } }
/// <summary> /// Player可以装备更多装备 /// 更新Player属性,更新WeaponMono属性 /// </summary> /// <param name="_equipData"></param> public void ChangeEquip(int _ID) { // 若ID超出或对应装备为空 if (_ID >= Player.EquipPack.Length || Player.EquipPack[_ID] == null) { return; } // 对应装备 IEquip _equip = Player.EquipPack[_ID]; // 原本有装备的话卸下 if (Player.Fit[(int)_equip.Type] < Player.EquipPack.Length) { DropEquip(Player.EquipPack[Player.Fit[(int)_equip.Type]]); } DressOnEquip(_equip); Player.Fit[(int)_equip.Type] = _ID; // 更新Fit装备 // 更新完Player的属性后更新WeaponMono的属性 UpdatePlayerWeapon(PlayerWeapon); }
public GameData() { //构造函数,设置默认存档 key = SystemInfo.deviceUniqueIdentifier; //设定密钥,根据具体平台设定// // Player Name = "我"; Rank = 1; Gold = 100; CanAttack = true; // 初始装备 Fit = new IEquip[6]; Fit[(int)FitType.Weapon] = UnityHelper.FindDic(GameMainProgram.Instance.dataBaseMgr.equipDict, "太刀"); // 初始背包,1~31值为-1 PropNum = new int[32]; for (int i = 1; i < 32; i++) { PropNum[i] = -1; } PropNum[0] = 3; // 其他 TasksData = new List <TaskData>(); }
/// <summary> /// 卸下装备 /// </summary> /// <param name="equip"></param> private void UnEquip(IEquip equip) { Player.MaxHP -= equip.HP; Player.MaxSP -= equip.SP; PlayerWeapon.BasicAttack -= equip.Attack; }
/// <summary> /// 卸下装备 /// </summary> /// <param name="equip"></param> private void UnEquip(IEquip equip) { Enemy.MaxHP -= equip.HP; Enemy.MaxSP -= equip.SP; EnemyWeapon.BasicAttack -= equip.Attack; }