/// <summary> /// 创建一个怪物角色的U3D对象,将其加入到RoleManager下 /// </summary> /// <param name="roleInfo"></param> /// <param name="pos"></param> /// <returns></returns> public Enemy CreateEnemy(RoleInfo roleInfo, int pos) { GameObject enemyObj = CreateRoleObject(roleInfo); RoleBase roleBase = RoleFactory.CreateRole(roleInfo); Enemy enemy = enemyObj.GetComponent <Enemy>(); switch (roleInfo.style) { case CommonDefine.RoleStyle.Normal: enemy.skin.sharedMaterial.SetColor("_Color", Color.white); break; case CommonDefine.RoleStyle.Red: enemy.skin.sharedMaterial.SetColor("_Color", Color.red); break; case CommonDefine.RoleStyle.Blue: enemy.skin.sharedMaterial.SetColor("_Color", Color.blue); break; } if (enemyObj != null) { enemyObj.GetComponent <Enemy>().Init(roleBase); enemyObj.transform.parent = m_hideRoleArea.transform; enemyObj.transform.localScale = Vector3.one; } AddEnemyInBattle(roleBase, pos); return(enemyObj.GetComponent <Enemy>()); }
public RoleMgr(Form1 view, GameDef.PlayerType player1, GameDef.PlayerType player2, GameDef.JudgeType judgeType) { Console.WriteLine($"Board is {GameDef.board_cell_length} x {GameDef.board_cell_length}"); Model = new Model(); View = view; P1 = player1; P2 = player2; Random random = new Random(); int num = random.Next(0, 2); //0、1 GameDef.PlayerType blackPlayer = num == 0 ? P1 : P2; GameDef.PlayerType whitePlayer = num == 0 ? P2 : P1; //assume black chess order is first RoleOrderMap.Add(0, PlayerFactory.CreatePlayer(blackPlayer, View, Model, this, ChessType.Black)); RoleOrderMap.Add(1, JudgeFactory.CreateJudge(judgeType, GameDef.BLACK_CHESS_JUDGE + "_" + blackPlayer.ToString(), View, Model, this, ChessType.Black)); RoleOrderMap.Add(2, PlayerFactory.CreatePlayer(whitePlayer, View, Model, this, ChessType.White)); RoleOrderMap.Add(3, JudgeFactory.CreateJudge(judgeType, GameDef.WHITE_CHESS_JUDGE + "_" + whitePlayer.ToString(), View, Model, this, ChessType.White)); OrderNum = 0; CurrentTurnRole = RoleOrderMap[OrderNum]; }
public static RoleBase CreateRole(int id, int level = 1) { var role = new RoleBase(); role.SetId(id, level); return(role); }
void UpdateCooperText() { string cooperName = RoleBase.GetCooperName(roleId); string proName = RoleBase.GetPreName(roleId); cooperText.text = $"[{cooperName}][{proName}]"; }
public override void OnStart() { m_Enemy = gameObject.GetComponentInChildren <RoleBase>(); path = new NavMeshPath(); m_Agent = m_Enemy.m_Agent; navAgent_Transform = m_Agent.transform; m_MoveVec = m_Enemy.m_MoveVec; }
public void Init(int heroId) { m_role = RoleManager.Instance.GetRoleById(heroId); m_role.RoleObject = gameObject; m_heroId = heroId; m_role.RoleActionFlag.AddFlag((long)StateDef.PlayerActionFlag.Idle); StartUp(); }
public override void Effect(RoleBase owner, RoleBase role) { int hurtValue = (int)(value * owner.skillParam); owner.SkillValue += hurtValue; owner.WholeHurtValue += hurtValue; role.BeSkillAttack(hurtValue); }
public void RollAtkTarget(RoleBase targetRoleBase) { // if (this.GetCurAtkTargetList() == null) // return; // if (!this.GetCurAtkTargetList().Contains(targetRoleBase)) // return; m_CurAtkTar = targetRoleBase; }
public override void Effect(RoleBase self, RoleBase[] target) { //击中了就回血 if (self.isAttackSuccess && self.isFight) { self.GetTreat((int)(self.HurtValue * param)); } }
public override void GetEffect(RoleBase role) { if (role == null | effectIndex == -1) { return; } role.getHurtParam -= valueParam[effectIndex]; }
public override void RemoveEffect(RoleBase role, int effectIndex) { if (role == null | effectIndex == -1) { return; } role.getHurtParam += valueParam[effectIndex]; }
public void Init(RoleBase roleBase) { m_role = roleBase; m_role.RoleObject = gameObject; m_enemyId = roleBase.m_heroId; m_role.RoleActionFlag.AddFlag((long)StateDef.PlayerActionFlag.Idle); StartUp(); }
/// <summary> /// 刷新选中英雄 /// </summary> void RefreshSelectHero() { foreach (KeyValuePair <int, RoleBase> pair in m_roleInBattleDic) { SelectedHero = pair.Value; break; } }
public override void OnEquipDown(RoleBase owner) { owner.afterGetHurt -= AddShouYu; this.owner = null; EventManager.UnRegistEvent(EventType.FightStart, Clear); }
public void LoadBorad() { ChessType none = ChessType.None; ChessType blac = ChessType.Black; ChessType whit = ChessType.White; if (GameDef.board_cell_length != 15) { Console.WriteLine("cannot Load board, because not 15X15 Board"); return; } ChessType[,] board = new ChessType[15, 15] { // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 { none, none, none, none, none, none, none, none, none, none, none, none, none, none, none }, //0 { none, none, none, none, none, none, none, none, none, none, none, none, none, none, none }, //1 { none, none, none, none, none, blac, none, none, none, none, none, none, none, none, none }, //2 { none, none, none, none, none, whit, none, none, none, none, none, none, none, none, none }, //3 { none, none, none, whit, blac, whit, none, none, none, none, whit, none, none, none, none }, //4 { none, none, none, blac, blac, whit, blac, blac, none, blac, blac, none, none, none, none }, //5 { none, none, none, blac, whit, whit, whit, whit, blac, none, none, none, none, none, none }, //6 { none, none, blac, blac, whit, blac, blac, blac, whit, none, none, none, none, none, none }, //7 { none, blac, none, blac, whit, whit, whit, whit, blac, none, none, none, none, none, none }, //8 { whit, blac, whit, whit, whit, blac, none, none, none, none, none, none, none, none, none }, //9 { none, none, whit, whit, blac, blac, none, none, none, none, none, none, none, none, none }, //10 { none, none, whit, none, none, none, none, none, none, none, none, none, none, none, none }, //11 { none, blac, none, none, none, none, none, none, none, none, none, none, none, none, none }, //12 { none, none, none, none, none, none, none, none, none, none, none, none, none, none, none }, //13 { none, none, none, none, none, none, none, none, none, none, none, none, none, none, none }, //14 }; int playedCount = 0; for (int y = 0; y < 15; ++y) { for (int x = 0; x < 15; ++x) { if (board[y, x] != ChessType.None) { playedCount += 1; Model.PutChessToBoard(x, y, board[y, x]); Chess myChess = ChessFactory.CreateChess(board[y, x]); myChess.SetPositionByCoordinate(x, y); View.PutChessOnView(myChess); } } } Player.TotalTurn = playedCount; OrderNum = playedCount % 2 == 0 ? 0 : 2; CurrentTurnRole = RoleOrderMap[OrderNum]; CurrentTurnRole.onMyTurn(); }
public void ShowRoleInfo(RoleBase role, RoleInfoType type = RoleInfoType.Pre) { if (role == null) { return; } int level = role.GetLevel(); var attributeData = DataClass.ConfigAttributeManager.Instance().allDatas; var roleAttributeData = DataClass.ConfigRoleManager.Instance().allDatas[role.GetRoleId()].attributes[level - 1]; var attributeSb = new System.Text.StringBuilder(); if (type == RoleInfoType.Pre) { for (int i = 0; i < 7; i++) { float nowValue = role.attributes[i]; //当前属性 int orValue = roleAttributeData[i]; //原属性 if (nowValue > orValue) { attributeSb.Append($"{attributeData[i].name}:<color=yellow>{nowValue.ToString()}</color> "); } else { attributeSb.Append($"{attributeData[i].name}:{nowValue.ToString()} "); } } } else { for (int i = 0; i < 5; i++) { float nowValue = role.attributes[i]; //当前属性 int orValue = roleAttributeData[i]; //原属性 if (nowValue > orValue) { attributeSb.Append($"{attributeData[i].name}:<color=yellow>{nowValue.ToString()}</color> "); } else { attributeSb.Append($"{attributeData[i].name}:{nowValue.ToString()} "); } } attributeSb.Append($"{attributeData[5].name}:{role.attributes[7].ToString()}/{role.attributes[5].ToString()} {attributeData[6].name}:{role.attributes[8].ToString()}/{role.attributes[6].ToString()}"); } string cooperName = DataClass.ConfigCooperationManager.Instance().allDatas[role.GetCooperId()].name; string proName = DataClass.ConfigProfessionManager.Instance().allDatas[role.GetProId()].name; string equipContent = $"{role.GetEquip(0)?.desc}\n{role.GetEquip(1)?.desc}"; string content = $"<size=50><color={ConstConfig.levelColor[role.cost]}>{role.name}</color></size>\n<color={ConstConfig.typeColor}>等级:{level.ToString()}【{cooperName}】 【{proName}】</color>\n\n{attributeSb.ToString()} {role.ShowMissCirtInfo()}\n<color={ConstConfig.skillColor}>{role.skill?.GetDesc()}</color>\n{equipContent}"; ShowInfo(content); }
//无敌 public static void SetWuDi(RoleBase role, float time) { role.SetWd(true); ViewManager.Get <WndTips>("WndTips").ShowMsg("不灭", role.fightTipPosition, UnityEngine.Color.yellow, time + 0.5f, 70, 40); TimeManager.RegistOneTime((id) => { role.SetWd(false); }, time, true); }
public override void RemoveEffect(RoleBase role, int effectIndex) { if (role == null | effectIndex == -1) { return; } role.attackValueParam -= valueParam[effectIndex] * 1.0f / 100; role.critRate -= critParam[effectIndex]; }
public override void RemoveEffect(RoleBase role, int effectIndex) { if (role == null | effectIndex == -1) { return; } role.attributes[2] -= valueParam[effectIndex]; role.missValue -= missParam[effectIndex]; }
public override void GetEffect(RoleBase role) { if (role == null | effectIndex == -1) { return; } role.attributes[2] += valueParam[effectIndex]; role.missValue += missParam[effectIndex]; }
public void ExchangeRoles(RoleBase role1, RoleBase role2) { int tmp = role1.m_playerPosition; role1.m_playerPosition = role2.m_playerPosition; role2.m_playerPosition = tmp; EventService.Instance.GetEvent <RolePositionChangeEvent>().Publish(); }
//如果目标角色 //眩晕 public static void SetXuanYun(RoleBase role, float time) { role.SetStop(true); ViewManager.Get <WndTips>("WndTips").ShowMsg("眩晕", role.fightTipPosition, UnityEngine.Color.gray, time + 0.5f, 70, 40); TimeManager.RegistOneTime((id) => { role.SetStop(false); }, time, true); }
private IEnumerator IE_RemoveRegistedRole(RoleBase role) { yield return(new WaitForSeconds(m_EftInterval)); if (m_EffectedBases.Contains(role)) { m_EffectedBases.Remove(role); } }
public override void GetEffect(RoleBase role) { if (role == null | effectIndex == -1) { return; } role.attackValueParam += valueParam[effectIndex] * 1.0f / 100; role.critRate += critParam[effectIndex]; }
/// <summary> /// 丢牌(被技能伤害) /// </summary> public void YiChuPaiId(RoleBase role) { int index = UnityEngine.Random.Range(0, role.HandCard.Count); //加入坟场 role.UsedCard.Add(role.HandCard[index]); //移除list中的id role.HandCard.Remove(role.HandCard[index]); }
//敌方go void UseEnemyGo(RoleBase role) { //颤抖 自己就不抖了 if (role == owner) { return; } role.fightRole.transform.DOShakePosition(0.5f, 3); }
private void Reset() { mySourceRole = null; mySourceRoleMissingConnector = false; myRoleReorderConnector = false; mySourceObjectType = null; myLastMouseDownRole = null; myLastMouseMoveRole = null; myEmulateDrag = false; }
//数据变动 void UseData(RoleBase owner, RoleBase target) { if (target != null) { for (int j = 0; j < effects.Count; j++) { effects[j].Effect(owner, target); } } }
/// <summary> /// 初始化 /// </summary> void Start() { ui = transform.Find("UI").gameObject; nick = ui.transform.Find("Name").GetComponent <Text>(); hp = ui.transform.Find("Hp").GetComponent <Slider>(); mp = ui.transform.Find("Mp").GetComponent <Slider>(); hpValue = hp.transform.Find("Value").GetComponent <Text>(); mpValue = mp.transform.Find("Value").GetComponent <Text>(); roleCtrl = GetComponent <RoleBase>(); }
private static RoleBase MapRoleBases(IDataReader reader) { RoleBase r = new RoleBase(); int nestedIndex = 0; r.Id = reader.GetSafeInt32(nestedIndex++); r.Name = reader.GetSafeString(nestedIndex++); r.Code = reader.GetSafeString(nestedIndex++); return(r); }