void Start( ) { enemyInst = GetComponent <EnemyInitial> ( ); enemyRoot = transform.parent.parent.parent; playerInst = GameAsst.Inst.player.GetComponent <PlayerInitial> ( ); playerRoot = GameAsst.Inst.player.transform.parent.parent.parent; }
///每回合开始更新角色属性 public void ResetBasicProperty( ) { PlayerInitial player = GameAsst.Inst.player.GetComponent <PlayerInitial> ( ); Transform plrRoot = GameAsst.Inst.player.transform.parent.parent.parent; player.Block = 0; plrRoot.Find("Block/Text").GetComponent <Text> ( ).text = Convert.ToString(player.Block); player.Mana = player.MaxMana; plrRoot.Find("Mana/Text").GetComponent <Text> ( ).text = Convert.ToString(player.MaxMana); player.Strength = 0; player.Agility = 0; player.WeakRnd--; player.FragileRnd--; player.WndRnd--; try { plrRoot.GetComponent <Buff> ( ).UpDateBuff(plrRoot.Find("BuffGroup/Strength")); } catch { } for (int i = 1; i < 4; i++) { if (uiRoleInform.GetChild(i).GetChild(0).childCount != 0) { EnemyInitial enemy = uiRoleInform.GetChild(i).GetChild(0).GetChild(0).GetChild(0).GetComponent <EnemyInitial> ( ); enemy.Strength = 0; enemy.Agility = 0; enemy.WeakRnd--; if (enemy.WeakRnd > 0) { uiRoleInform.GetChild(i).GetComponent <Buff> ( ).UpDateBuff("Weak", enemy.WeakRnd); } enemy.FragileRnd--; if (enemy.FragileRnd > 0) { uiRoleInform.GetChild(i).GetComponent <Buff> ( ).UpDateBuff("Fragile", enemy.FragileRnd); } enemy.WndRnd--; if (enemy.WndRnd > 0) { uiRoleInform.GetChild(i).GetComponent <Buff> ( ).UpDateBuff("Wounded", enemy.WndRnd); } } } }
///技能计算过程 public void SkillToDo(GameObject tar) { game = GameObject.Find("Launch").GetComponent <Game> ( ); PlayerInitial plrInit = GameAsst.Inst.player.GetComponent <PlayerInitial> ( ); Transform playerRoot = GameAsst.Inst.player.transform.parent.parent.parent; plrInit.Strength += Strength; if (plrInit.Strength > 0) { CheckBuff(playerRoot, strengthName, game.strengthSprite, 1); } plrInit.Agility += Agility; if (plrInit.Agility > 0) { CheckBuff(playerRoot, agilitythName, game.agilitySprite, 1); } if (tar.CompareTag("Enemy")) { EnemyInitial enmInit = tar.GetComponent <EnemyInitial> ( ); Transform enmRoot = tar.transform.parent.parent.parent; enmInit.WeakRnd += WeakRnd; if (enmInit.WeakRnd > 0) { enmInit.Weak = 0.25f; CheckBuff(enmRoot, weakName, game.weakSprite, enmInit.WeakRnd); } else { enmInit.Weak = 0; } enmInit.FragileRnd += FragileRnd; if (enmInit.FragileRnd > 0) { enmInit.Fragile = 0.25f; CheckBuff(enmRoot, fragileName, game.fragileSprite, enmInit.FragileRnd); } else { enmInit.Fragile = 0; } enmInit.WndRnd += WndRnd; if (enmInit.WndRnd > 0) { enmInit.Wounded = 0.5f; CheckBuff(enmRoot, woundedName, game.woundedSprite, enmInit.WndRnd); } else { enmInit.Wounded = 0; } float dmg = (Attack + plrInit.Strength) * (1 - plrInit.Weak) * (1 + enmInit.Wounded) * Repeat; int damage = Convert.ToInt32(Math.Floor(dmg)); dmg -= damage; if (dmg >= 0.5) { damage++; } int tarHp = enmInit.Hp; tarHp -= damage; enmInit.Hp = tarHp; UpdateEnemyUiInform(tar, tarHp); } float blc = (Block + plrInit.Agility) * (1 - plrInit.Fragile); int block = Convert.ToInt32(Math.Floor(blc)); blc -= block; if (blc >= 0.5) { block++; } plrInit.Block += block; string blockToStr = Convert.ToString(plrInit.Block); playerRoot.Find("Block/Text").GetComponent <Text> ( ).text = blockToStr; if (rdTars > 0) { rdTars--; BattleMgr.Inst.tarsList.Clear( ); if (BattleMgr.Inst.liveList.Count != 0) { BattleMgr.Inst.ChooseRandomTar( ); BattleMgr.Inst.UseCard( ); } } //int mana = plrInit.Mana; //mana -= ManaCast; //plrInit.Mana = mana; //UpdatePlayerUiInform (mana); BattleMgr.Inst.RemoveToUsed( ); if (BattleMgr.Inst.liveList.Count == 0) { GameAsst.Inst.lvPass = true; } if (DrawNum > 0) { BattleMgr.Inst.PickUpCard(DrawNum); } }