public BoxCollider2D BoxCollider2D; //模型的碰撞体 /**添加控制脚本**/ override protected void AddScript(GameObject go) { //增加控制中心控制脚本 if (go.GetComponent <ActionControler>() != null) { return; } Controller = go.AddComponent <ActionControler>(); Controller.Me = this; //增加状态控制脚本 var statuController = go.AddComponent <PlayerStatuController>(); Controller.StatuController = statuController; //增加技能控制脚本 Controller.SkillController = go.AddComponent <SkillController>(); Controller.SkillController.MeController = Controller as ActionControler; //增加攻击控制脚本 var attackController = go.AddComponent <AttackControllerBase>(); attackController.MeController = Controller as ActionControler; Controller.AttackController = attackController; //增加受击控制脚本 var beAttackedController = go.AddComponent <BeAttackedControllerBase>(); beAttackedController.meController = Controller as ActionControler; Controller.BeAttackedController = beAttackedController; //增加动画事件控制脚本 Controller.AnimationEventController = GoCloth.GetComponent <AnimationEventController>() ?? GoCloth.AddComponent <AnimationEventController>(); Controller.AnimationEventController.skillController = Controller.SkillController; }
/**添加控制脚本**/ override protected void AddScript(GameObject go) { //增加控制中心控制脚本 if (go.GetComponent <ActionControler>() != null) { return; } Controller = go.AddComponent <ActionControler>(); Controller.Me = this; Controller.Me.Animator = Controller.Me.GoCloth.GetComponent <Animator>(); //增加状态控制脚本 var statuController = go.AddComponent <StatuControllerBase>(); Controller.StatuController = statuController; statuController.MeControler = Controller as ActionControler; //增加技能控制脚本 Controller.SkillController = go.AddComponent <SkillController>(); Controller.SkillController.MeController = Controller as ActionControler; //增加攻击控制脚本 var attackController = go.AddComponent <PetAttackController>(); attackController.MeController = Controller as ActionControler; Controller.AttackController = attackController; //增加受击控制脚本 var beAttackedController = go.AddComponent <BeAttackedControllerBase>(); beAttackedController.meController = Controller as ActionControler; Controller.BeAttackedController = beAttackedController; //增加动画事件控制脚本 Controller.AnimationEventController = GoCloth.GetComponent <AnimationEventController>() ?? GoCloth.AddComponent <AnimationEventController>(); Controller.AnimationEventController.skillController = Controller.SkillController; //增加移动控制脚本 var monsterMoveController = go.AddComponent <MoveControllerBase>(); monsterMoveController.AnimationEventController = Controller.AnimationEventController; monsterMoveController.MeController = Controller as ActionControler; Controller.MoveController = monsterMoveController; monsterMoveController.AnimationParameter = Controller.AnimationParameter; //增加AI控制脚本 var aiController = go.AddComponent <PetAiController>(); aiController.MeController = Controller as ActionControler; Controller.AiController = aiController; //增加天赋技能处理脚本 var talentSkillController = go.AddComponent <PetTalentSkillController>(); talentSkillController.MeController = Controller as ActionControler; Controller.TalentSkillController = talentSkillController; }
/**添加控制脚本**/ override protected void AddScript(GameObject go) { //增加控制中心控制脚本 if (go.GetComponent <ActionControler>() != null) { return; } Controller = go.AddComponent <ActionControler>(); Controller.Me = this; Controller.Me.Animator = Controller.Me.GoCloth.GetComponent <Animator>(); //增加状态控制脚本 var statuController = go.AddComponent <StatuControllerBase>(); Controller.StatuController = statuController; statuController.MeControler = Controller as ActionControler; //增加移动控制脚本 var monsterMoveController = go.AddComponent <MoveControllerBase>(); monsterMoveController.AnimationEventController = Controller.AnimationEventController; monsterMoveController.MeController = Controller as ActionControler; Controller.MoveController = monsterMoveController; monsterMoveController.AnimationParameter = Controller.AnimationParameter; //增加攻击控制脚本 var attackController = go.AddComponent <AttackControllerBase>(); attackController.MeController = Controller as ActionControler; Controller.AttackController = attackController; //增加技能控制脚本 SkillController skillController = Controller.SkillController = go.AddComponent <SkillController>(); skillController.MeController = Controller as ActionControler; Controller.AnimationEventController = GoCloth.GetComponent <AnimationEventController>() ?? GoCloth.AddComponent <AnimationEventController>(); Controller.AnimationEventController.skillController = Controller.SkillController; SysTrap sysTrapVo = GetTrapVo().SysTrapVo; switch (sysTrapVo.Type) { case 1: //铁锚类陷阱 var trapAnchorControl = GoCloth.AddComponent <TrapAnchorControl>(); trapAnchorControl.ActionControler = Controller as ActionControler; break; case 2: //触碰接触伤害类陷阱 var trapColliderControl = GoCloth.AddComponent <TrapCollideControl>(); trapColliderControl.ActionControler = Controller as ActionControler; break; } BoxCollider2D = GoCloth.GetComponent <BoxCollider2D>(); }
/**添加控制脚本**/ override protected void AddScript(GameObject go) { //增加控制中心控制脚本 if (go.GetComponent <ActionControler>() != null) { return; } Controller = go.AddComponent <ActionControler>(); Controller.Me = this; Controller.Me.Animator = Controller.Me.GoCloth.GetComponent <Animator>(); Controller.Me.Animator.applyRootMotion = false; BoxCollider2D = GoCloth.GetComponent <BoxCollider2D>(); if (BoxCollider2D != null) { BoxCollider2D.enabled = false; } }
/**添加控制脚本**/ override protected void AddScript(GameObject go) // go 为 Box2d刚体对象 如400_2014 { if (go.GetComponent <ActionControler>() != null) { return; } Controller = go.AddComponent <ActionControler>(); Controller.Me = this; Controller.Me.Animator = Controller.Me.GoCloth.GetComponent <Animator>(); //改变怪物的速度 (Controller as ActionControler).ChangeSpeed((GetVo() as MonsterVo).MonsterVO.speed / GameConst.PIXEL_TO_UNITY); //增加状态控制脚本 var statuController = go.AddComponent <MonsterStatuController>(); statuController.MeControler = Controller as ActionControler; Controller.StatuController = statuController; //增加技能控制脚本 SkillController skillController = Controller.SkillController = go.AddComponent <SkillController>(); skillController.MeController = Controller as ActionControler; Controller.AnimationEventController = GoCloth.GetComponent <AnimationEventController>() ?? GoCloth.AddComponent <AnimationEventController>(); Controller.AnimationEventController.skillController = Controller.SkillController; //增加抓投控制脚本; var projectileController = GoCloth.GetComponent <GraspThrowController>() ?? GoCloth.AddComponent <GraspThrowController>(); projectileController.MeController = Controller as ActionControler; Controller.GraspThrowController = projectileController; Controller.AnimationEventController.GraspThrowController = Controller.GraspThrowController; //增加动画参数控制脚本 Controller.AnimationParameter = GoCloth.GetComponent <AnimationParameter>() ?? GoCloth.AddComponent <AnimationParameter>(); //增加移动控制脚本 var monsterMoveController = go.AddComponent <MonsterMoveController>(); monsterMoveController.AnimationEventController = Controller.AnimationEventController; monsterMoveController.MeController = Controller as ActionControler; Controller.MoveController = monsterMoveController; monsterMoveController.AnimationParameter = Controller.AnimationParameter; //增加攻击控制脚本 var attackController = go.AddComponent <MonsterAttackController>(); attackController.MeController = Controller as ActionControler; Controller.AttackController = attackController; //增加受击控制脚本 var beAttackedController = go.AddComponent <MonsterBeAttackedController>(); beAttackedController.meController = Controller as ActionControler; Controller.BeAttackedController = beAttackedController; //增加死亡控制脚本 var deathController = go.AddComponent <MonsterDeathController>(); deathController.MeController = Controller as ActionControler; //增加AI控制脚本 string aiList = (GetVo() as MonsterVo).MonsterVO.ai_list; //var aiController = go.AddComponent<MonsterAiController>(); //aiController.MeController = Controller as ActionControler; //Controller.AiController = aiController; if (aiList == "850002") { listAiDataCtr = AiDataParser.Me().Parser(aiList); } /*// 将要做 * _aiData = new AiData(); * listAiDataCtr = new List<AiData>(); * * SysMonsterAiVo monsterAiVo = BaseDataMgr.instance.GetDataById<SysMonsterAiVo>(uint.Parse(aiList)); * string strAiValue = monsterAiVo.AiValue; // 122=720000,100|218=1;104=5|200=930035 * * _aiData.ID = int.Parse(aiList); * string[] strEachState = strAiValue.Split(';'); * for (int i = 0; i < strEachState.Length; i++) * { * string[] strConditionState = strEachState[i].Split('|'); * * // 122=720000,100 * string[] strConditionValue = strConditionState[0].Split('='); * _aiData.conditionType = int.Parse(strConditionValue[0]); * * string []value = strConditionValue[1].Split(','); * for (int k = 0; k < value.Length; k++) * { * _aiData.conditionParamList.Add(int.Parse(value[k])); * } * * // 218=1 * string[] strActionValue = strConditionState[1].Split('='); * _aiData.actionType = int.Parse(strActionValue[0]); * value = strActionValue[1].Split(','); * for (int k = 0; k < value.Length; k++) * _aiData.actionParamList.Add(int.Parse(value[k])); * * listAiDataCtr.Add(_aiData); // 一个条件就一个 _aiData; * } */ if (aiList != null && aiList.Contains("1")) { Controller.AiController = go.AddComponent <MonsterAiController_Far>(); // 添加远程脚本 go.GetComponent <MonsterAiController_Far>().MeController = Controller as ActionControler; //Debug.Log("****添加新AI脚本MonsterAiController_Far"); } else if (aiList != null && aiList.Contains("2")) { Controller.AiController = go.AddComponent <MonsterAiController_Far2>(); // 添加远程脚本 go.GetComponent <MonsterAiController_Far2>().MeController = Controller as ActionControler; Debug.Log("****添加新AI脚本MonsterAiController_Far2"); } else { Controller.AiController = go.AddComponent <MonsterAiController>(); go.GetComponent <MonsterAiController>().MeController = Controller as ActionControler; } BoxCollider2D = GoCloth.GetComponent <BoxCollider2D>(); BoxCollider2D.enabled = false; SetStandClothGoPosition(); GetMeVoByType <MonsterVo>().Controller = Controller as ActionControler; InitBoxColliderData(); }
override protected void AddScript(GameObject go) { if (go.GetComponent <MeControler>() != null) { return; } Controller = go.AddComponent <MeControler>(); Controller.Me = this; Controller.Me.Animator = GoCloth.GetComponent <Animator>(); //增加状态控制脚本 var statuController = go.AddComponent <MeStatuController>(); statuController.MeControler = Controller as ActionControler; Controller.StatuController = statuController; //增加技能控制脚本 Controller.SkillController = go.AddComponent <SkillController>(); Controller.SkillController.MeController = Controller as PlayerControler; //增加动画事件控制脚本 Controller.AnimationEventController = GoCloth.GetComponent <AnimationEventController>() ?? GoCloth.AddComponent <AnimationEventController>(); Controller.AnimationEventController.skillController = Controller.SkillController; //增加投射物控制脚本; var projectileController = GoCloth.GetComponent <GraspThrowController>() ?? GoCloth.AddComponent <GraspThrowController>(); projectileController.MeController = Controller as ActionControler; Controller.GraspThrowController = projectileController; Controller.AnimationEventController.GraspThrowController = Controller.GraspThrowController; //增加动画参数控制脚本 Controller.AnimationParameter = GoCloth.GetComponent <AnimationParameter>() ?? GoCloth.AddComponent <AnimationParameter>(); //增加移动控制脚本 var moveContorller = go.AddComponent <PlayerMoveController>(); moveContorller.AnimationEventController = Controller.AnimationEventController; Controller.MoveController = moveContorller; //增加攻击控制脚本 var attackController = go.AddComponent <PlayerAttackController>(); attackController.MeController = Controller as ActionControler; Controller.AttackController = attackController; //增加受击控制脚本 var beAttackedController = go.AddComponent <PlayerBeAttackedController>(); beAttackedController.meController = Controller as ActionControler; Controller.BeAttackedController = beAttackedController; //增加死亡控制脚本 var deathController = go.AddComponent <PlayerDeathController>(); deathController.MeController = Controller as ActionControler; //增加AI控制脚本 var aiController = go.AddComponent <MeAiController>(); aiController.MeController = Controller as MeControler; Controller.AiController = aiController; //添加连斩统计脚本 var continueCutMgr = go.AddComponent <ContinueCutMgr>(); Controller.ContCutMgr = continueCutMgr; BoxCollider2D = GoCloth.GetComponent <BoxCollider2D>(); BoxCollider2D.enabled = false; SetStandClothGoPosition(); GetMeVoByType <PlayerVo>().Controller = Controller as ActionControler; }