public static void RunNode(ISkillNodeRun run, SkillNode node) { // UnityEngine.Debug.Log("runNode ["+node.trigger+"] "+node.type); switch (node.type) { case SkillNodeType.RotatePlayer: if (run.skill.player != null) { var rot = run.skill.player.Input.GetJoyStickDirection(run.skill.key); if (rot.magnitude < 0.1f) { rot = run.skill.player.transform.forward; } run.skill.player.transform.Rotation = rot.ToRotation(); } break; case SkillNodeType.MoveCtr: if (node.boolParams[0]) { run.skill.player.CanMove = true; run.skill.player.animRootMotion(false); } else { run.skill.player.CanMove = false; run.skill.player.animRootMotion(true); } break; case SkillNodeType.WaitTime: run.skill.player.client.coroutine.WaitCall(node.fixedParams[0], () => { RunNodes(run, node.GetNodes(SkillTrigger.Time)); }); break; case SkillNodeType.LoopTime: //RunNodes(node.GetNodes(SkillTrigger.Time)); //var c = run.player.client.coroutine.WaitCall(node.fixedParams[1], // () => // { // RunNodes(node.GetNodes(SkillTrigger.Time)); // } // , true); //times.Add(node.fixedParams[0], c); break; case SkillNodeType.Damage: foreach (var other in run.skill.others) { if (other is HealthData) { if (other != run.skill.player) { var enemy = other as HealthData; //Debug.LogError("damage " + run.skill.weapon.weaponData.fixedParams["mainDamage"]); if (run.skill.player.client.GetManager <TeamManager>().IsEnemy(enemy, run.skill.player)) { enemy.GetHurt(node.fixedParams[0] + run.skill.weapon.weaponData.fixedParams["mainDamage"]); } } } } break; case SkillNodeType.StopLoop: //coroutine.StopCoroutine(times[node.fixedParams[0]]); //times.Remove(node.fixedParams[0]); break; case SkillNodeType.GunFire: run.skill.player.weaponSystem.curWeapon <Gun>().Fire(node, run); break; case SkillNodeType.CreatCheck: var check = new SkillCheck(); check.skill = run.skill; check.Check(run.skill.player, node.fixedParams[0], node.fixedParams[1], node.fixedParams[2], node); break; case SkillNodeType.CreateBullet: ShootBullet(run.skill.player, run.skill.player.transform.Position, run.skill.player.transform.Rotation); break; default: break; } }
public static void SetTrigger(this SkillNode node, SkillTrigger trigger, ISkillNodeRun run) { RunNodes(run, node.GetNodes(trigger)); }