void Awake() { fightfsm = transform.GetComponent <com_FightFSM>(); ap = transform.GetComponent <AniPlayer>(); ai_table = fightfsm.aiStateTable; table = fightfsm.stateTable; }
public void Show(AniPlayer ani, Skills skill) { this.skill = skill; this.ani = ani; //var c = ani.clips[0]; this.Show(); }
private void Awake() { aniPlayer = this.GetComponent <AniPlayer>(); State = new DataDrive_Service(); //攻击 this.State.RegisterData("DoBlockEvent"); //执行blockEvent this.State.RegisterData("CurBlockEnd"); //当前block结束 this.State.RegisterData("AllBlockEnd"); //释放技能结束 }
public void Show(List <SkillBlock> blocks, int index, AniPlayer ani) { this._ani = ani; this._skillBlocks = blocks; this._index = index; //this._aniClips = ani.clips; this._curClip = ani.clips[0]; this.Show(); }
public void Init() { var o = BResources.Load <GameObject>(data.ResurcePath); this.Trans = GameObject.Instantiate(o).transform; this.Trans.SetParent(Client.SceneRoot, false); // this.AniPlayer = this.Trans.GetComponent <AniPlayer>(); this.SkillPlayer = this.Trans.GetComponent <SkillPlayer_TBS>(); }
public void Show(AniPlayer ani, Skills skill) { this.skill = skill; this.ani = ani; if (this.skill.SkillList == null) { this.skill.SkillList = new List <Game.Battle.Skill.Skill>(); } //var c = ani.clips[0]; skillEditorDict = EditorSkillTool.GetSkillEditorDict(); this.Show(); }
public string SaveAniPlayer(AniPlayer player, Animator animator) { int id = player.GetInstanceID(); if (this.HaveCache(id)) { return(this.GetCache(id)); } string path = UnityEditor.AssetDatabase.GetAssetPath(animator.runtimeAnimatorController); var writer = new AnimationWriter(player.transform); byte[] bs = writer.WriteGLTF(); var name = path.Substring(0, path.LastIndexOf("/") + 1) + player.gameObject.name + ".ani.bin"; this.AddFileBuffer(name, bs); return(name); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (SkillsPlayer == null) { this.SkillsPlayer = this.target as SkillPlayer_TBS; } if (ani == null) { ani = this.SkillsPlayer.transform.GetComponent <AniPlayer>(); } if (this.SkillsPlayer.GetComponent <AniPlayer>() == null) { EditorGUILayout.HelpBox("请添加Ani Player", MessageType.Info); return; } if (SkillsPlayer.Skills == null) { if (GUILayout.Button("创建.skill数据")) { var _skill = ScriptableObject.CreateInstance <Skills>(); var cp = AssetDatabase.GetAssetPath(ani.clips[0].GetInstanceID()); string path = System.IO.Path.GetDirectoryName(cp); Debug.Log(path); string outpath = path + "/" + SkillsPlayer.name + ".Skills.asset"; AssetDatabase.CreateAsset(_skill, outpath); var src = AssetDatabase.LoadAssetAtPath(outpath, typeof(Skills)) as Skills; this.SkillsPlayer.Skills = src; AssetDatabase.SaveAssets(); } } else { if (GUILayout.Button("打开")) { this.window = (Window_SkillTurnBase)EditorWindow.GetWindow(typeof(Window_SkillTurnBase), false, "回合制技能编辑"); window.Show(this.ani, this.SkillsPlayer.Skills); } } }
private void Update() { if (isInjured) { elapseTime += Time.deltaTime; ShowInjuredEffect(); } if (u == null) { return; } if (IsExampleUnit) { return; } var dt = Time.deltaTime * SpeedUp; var toPos = u.Pos; var toDir = -(float)u.Dir; var fromPos = transform.localPosition; // 同步位置 var v = u.cfg.MaxVelocity; if (v != 0) { var maxDist = v * dt; var nowModelPos = transform.localPosition; var toModelPos = new Vector3((float)toPos.x, transform.localPosition.y, (float)toPos.y); var modelPosDist = (toModelPos - nowModelPos).magnitude; if (maxDist < modelPosDist && modelPosDist < v * 0.5 /* 超过 0.5s 距离也直接追上 */) { toModelPos = (float)(maxDist / modelPosDist) * (toModelPos - nowModelPos) + nowModelPos; } if (transform.localPosition != toModelPos) { AniPlayer.Run(); } transform.localPosition = toModelPos; } else if (u.cfg.MaxVelocity > 0) { AniPlayer.Idle(); } // 地雷埋地下 if (u.cfg.AITypes != null && u.cfg.AITypes[0] == "Landmine") { if (u.PreferredVelocity == Vec2.Zero) { var pos = gameObject.transform.localPosition; gameObject.transform.localPosition = new Vector3(pos.x, -1.0f, pos.z); } else { var pos = gameObject.transform.localPosition; gameObject.transform.localPosition = new Vector3(pos.x, 0.0f, pos.z); } } // 同步角度 var dd = ((Fix64)(toDir - nowModelDir)).RangeIn180().Clamp(-720 * dt, 720 * dt); if (dd > float.Epsilon || dd < -float.Epsilon) { var me = GameCore.Instance.MePlayer; nowModelDir += (float)dd; transform.localRotation = Quaternion.Euler(0, nowModelDir, 0); } if (u.TrappedTimeLeft > 0) { ChangeMatState(3); } else if (!u.IsInvisible) { ChangeMatState(1); } if (u.cfg.InVisible && !u.IsInvisible) { SetNormalMat(); } }
public void Show(AniPlayer ani) { this.ani = ani; base.Show(); }
public void Show(List <SkillBlock> blocks, AniPlayer ani) { this._ani = ani; this._skillBlocks = blocks; this.Show(); }