// 更新触发状态(继承自sdBehaviourState)aa public override void UpdateState() { if (mIsInState == true) { mCurrentDelayTime -= Time.deltaTime; if (mCurrentDelayTime <= 0.0f) { MonsterAutoFight kMonsterAutoFight = mBehaviourAdvancedState.MonsterAutoFightComponent; PetAutoFight kPetAutoFight = kMonsterAutoFight as PetAutoFight; if (kPetAutoFight != null) { sdGameMonster kMonster = kMonsterAutoFight.Actor as sdGameMonster; if (kMonster != null) { int iSkillID = mSkillID; if (iSkillID == -1 || iSkillID == 0) { iSkillID = (int)kMonster.Property["SpSkill"]; //< 尝试获取手动技能aa } int iErroeCode = 0; kPetAutoFight.DoXPSkill(iSkillID, ref iErroeCode); } } mCurrentDelayTime = 0.0f; } } }
// 瀹犵墿鎵嬪姩鎶鑳肩鐢ㄤ簬瀹犵墿)aa public bool DoXPSkill(ref int iErrorCode) { if (GetActorType() == ActorType.AT_Pet) { PetAutoFight kPetAutoFight = mAutoFight as PetAutoFight; int iSkillId = (int)Property["SpSkill"]; if (iSkillId != 0) { return(kPetAutoFight.DoXPSkill(iSkillId, ref iErrorCode)); } } return(false); }
// protected override void Start() { base.Start(); // 鑾峰彇妯″瀷鍙婃帶鍒跺櫒淇℃伅aa GameObject rootRenderNode = transform.FindChild("@RenderNode").gameObject; gatherRenderNodesInfo(rootRenderNode); gatherMeshes(rootRenderNode); GatherMeshShaders(); renderNode = rootRenderNode; renderNode.SetActive(false); for (int k = 0; k < renderNode.transform.childCount; ++k) { Transform kChildNode = renderNode.transform.GetChild(k); if (kChildNode.name.Equals("Bip01")) { boneRoot = kChildNode.gameObject; break; } } mAnimController = renderNode.GetComponent <Animation>(); // mAnimController.enabled = false; mMotionController = this.gameObject.GetComponent <CharacterController>(); mMotionController.enabled = false; mNavAgent = this.gameObject.GetComponent <NavMeshAgent>(); mNavAgent.enabled = false; mSelfAudioSource = this.gameObject.GetComponent <AudioSource>(); // mSelfAudioSource.enabled = false; // 鍦烘櫙淇℃伅aa mMainCamera = sdGameLevel.instance.mainCamera.GetComponent <Camera>(); mTuituLogic = sdGameLevel.instance.tuiTuLogic; // 鍔犺浇鎬?墿灞炴ц〃(鍩虹?灞炴﹁aa if (ActorType.AT_Pet == GetActorType()) { Hashtable kTable = sdNewPetMgr.Instance.GetPetPropertyFromDBID(mDBID); Property = sdConfDataMgr.CloneHashTable(kTable); } else { Hashtable kMonsterProperty = sdConfDataMgr.Instance().GetTable("MonsterProperty"); if (Application.platform == RuntimePlatform.WindowsEditor) { if (!kMonsterProperty.ContainsKey(templateId)) { Debug.LogError("monster templateID error=" + templateId); } } Hashtable kTable = kMonsterProperty[templateId] as Hashtable; Property = sdConfDataMgr.CloneHashTable(kTable); //娣辨笂BOSS闇瑕佺壒娈婂?鐞嗚?閲庬. if (isLapBoss && !sdGameLevel.instance.testMode) { if (sdActGameMgr.Instance.m_uuLapBossLastBlood > 0) { Property["HP"] = (int)sdActGameMgr.Instance.m_uuLapBossLastBlood; } else { Property["HP"] = (int)sdActGameMgr.Instance.m_uuWorldBossLastBlood; } } else { Property["HP"] = Property["MaxHP"]; //< 淇??琛閲庣鍙?湁鎬?墿闇瑕佷慨姝㈣aa } } Property["MaxSP"] = 100; //< 淇??鏈楂樻硶鍔涘糰a Property["SP"] = Property["MaxSP"]; //< 淇??娉曞姏鍊糰a // 鍒濆?鍖栬?鑹叉秷澶辨椂闂碼a mDisappeared = false; mDisapearTime = (int)Property["DisappearTime"] / 1000.0f; // m_summonInfo = sdConfDataMgr.CloneHashTable(sdConfDataMgr.Instance().m_BaseSummon); m_SkillEffect = sdConfDataMgr.CloneHashTable(sdConfDataMgr.Instance().m_BaseSkillEffect); // 鍒濆?鍖栬?鏉?a LoadHPUI(); // 鍒濆?鍖栭変腑鐩?爣鐗规晥aa //if (GetActorType() == ActorType.AT_Pet) // LoadTargetEffect(); // 鍒涘缓鎶鑳絘a CreateSkill_Action((ulong)templateId); // 鍒濆?鍖栦釜浣揂I鍙傛暟aa if (ActorType.AT_Pet == GetActorType()) { if (mAnimController != null) { mAnimController.cullingType = AnimationCullingType.AlwaysAnimate; } PetAutoFight kPetAutoFight = new PetAutoFight(); kPetAutoFight.FollowDistance = ((int)Property["FollowDistance"]) / 1000.0f; kPetAutoFight.BattleFollowDistance = ((int)Property["BattleFollowDistance"]) / 1000.0f; kPetAutoFight.EyeDistance = ((int)Property["EyeSize"]) / 1000.0f; kPetAutoFight.Enable = useAI; kPetAutoFight.AutoRetreat = (int)(Property["Retreat"]) != 0; kPetAutoFight.RetreatDetectInterval = ((int)Property["RetreatDetectInterval"]) / 1000.0f; kPetAutoFight.RetreatDetectMinDistance = ((int)Property["RetreatDetectMinDistance"]) / 1000.0f; kPetAutoFight.RetreatElapseTime = ((int)Property["RetreatElapseTime"]) / 1000.0f; kPetAutoFight.NotifyChangeTarget += NotifyBattleSystemChangeTarget; sdSkill kSkill = skillTree.getSkill(1001); if (kSkill != null) { sdBaseState kState = kSkill.actionStateList[0]; int iCastDistance = (int)kState.stateData["CastDistance"]; kPetAutoFight.BattleDistance = (iCastDistance) * 0.001f; } mAutoFight = kPetAutoFight; mAutoFight.SetActor(this); } else { MonsterAutoFight kMonsterAutoFight = new MonsterAutoFight(); kMonsterAutoFight.EyeDistance = ((int)Property["EyeSize"]) / 1000.0f; kMonsterAutoFight.ChaseDistance = ((int)Property["ChaseSize"]) / 1000.0f; kMonsterAutoFight.Enable = useAI; kMonsterAutoFight.NotifyChangeTarget += NotifyBattleSystemChangeTarget; sdSkill kSkill = skillTree.getSkill(1001); if (kSkill != null) { sdBaseState kState = kSkill.actionStateList[0]; int iCastDistance = (int)kState.stateData["CastDistance"]; kMonsterAutoFight.BattleDistance = (iCastDistance) * 0.001f; } mAutoFight = kMonsterAutoFight; mAutoFight.SetActor(this); } // 鍒濆?鍖栫兢浣揂I鍙傛暟aa if (ActorType.AT_Pet == GetActorType()) { sdBehaviourNode kBehaviourNode = sdBehaviourManager.GetSingleton().GetBehaviourNode(1); if (kBehaviourNode != null) { kBehaviourNode.AddActor(this); } } // LoadShadow(); }