public void CharCast2() { SequenceAction sequence = new SequenceAction(); sequence.name = "CastSequence"; AnimatorAction action; action = new AnimatorAction(); action.doneWhenHit = true; action.name = "character"; action.animator = charAnimator; action.triggerState = "Cast"; sequence.AddAction(action); AnimatorAction fireAction = new AnimatorAction(); fireAction.name = "vfx2"; fireAction.animator = animator2; fireAction.triggerState = "Fire"; sequence.AddAction(fireAction); actionManager.RunAction(sequence); }
public void MultiTarget() { ParallelAction parallel = new ParallelAction(); parallel.name = "SkillCast"; string vfx = "Thunder"; AnimeAction action1 = CreateCastAction("target1", vfx, enemyAnimator, 1000); parallel.AddAction(action1); AnimeAction action2 = CreateCastAction("target2", vfx, enemyAnimator2, 777); parallel.AddAction(action2); AnimatorAction animeAction = new AnimatorAction(); animeAction.name = "character"; animeAction.animator = charAnimator; animeAction.triggerState = "Cast"; animeAction.onHitAction = parallel; actionManager.RunAction(animeAction); }
public void EnemyHit() { SequenceAction sequence = new SequenceAction(); sequence.name = "HitSequence"; AnimatorAction action = new AnimatorAction(); action.name = "enemyHit"; action.animator = enemyAnimator; action.triggerState = "Hit"; sequence.AddAction(action); HitValueAction hitAction = new HitValueAction(); hitAction.valueTextPrefab = hitValuePrefab; hitAction.hitValue = 1000; hitAction.position = enemyAnimator.transform.position + new Vector3(0, 1, -2); sequence.AddAction(hitAction); //hitAction.position = new Vector3(0, 0, -2); actionManager.RunAction(sequence); //action.animator = bat }
void DoAction(AnimatorAction _actionType, ActionParamtersType _ActionParamtersType, int _intValue = 1, float _floatValue = 0.0f)//播放或停止动作 { this.enity.OnPlayAnimation(_actionType, _intValue, _floatValue); //if (animator != null && animator.parameterCount > (int)_actionType) //{ // string _animatorParameterName = animator.GetParameter((int)_actionType).name; // switch (_ActionParamtersType) // { // case ActionParamtersType.Float: // if (animator.GetFloat(_animatorParameterName) != _floatValue) // animator.SetFloat(_animatorParameterName, _floatValue); // break; // case ActionParamtersType.Int: // if (animator.GetInteger(_animatorParameterName) != _intValue) // animator.SetInteger(_animatorParameterName, _intValue); // break; // case ActionParamtersType.Bool: // if (animator.GetBool(_animatorParameterName) != _intValue > 0) // animator.SetBool(_animatorParameterName, _intValue >0); // break; // case ActionParamtersType.Trigger: // animator.SetTrigger(_animatorParameterName); // break; // default: // break; // } //} }
public void VFX2() { AnimatorAction action = new AnimatorAction(); action.name = "vfx2"; action.animator = animator1; action.triggerState = "Thunder"; actionManager.RunAction(action); //action.animator = bat }
public void VFX1() { AnimatorAction action = new AnimatorAction(); action.name = "vfx1"; action.animator = animator1; action.triggerState = "Fire"; actionManager.RunAction(action); //action.animator = bat }
/// <summary> /// 当点击后值改变是触发 (切换下拉选项) /// </summary> /// <param name="v">是点击的选项在OptionData下的索引值</param> void OnValueChange(int v) { //切换选项 时处理其他的逻辑... Debug.Log("点击下拉控件的索引是..." + v); if (CurrentHero == null) { return; } CurrentHero.OnPlayAnimation((AnimatorAction)v); currentAnimatorAction = (AnimatorAction)v; }
void Start() { //LCustomizedCharacterSamples = DataManager.GetInstance().GetGameObjectsByPath("Prefabs/Customized Character Samples", ".prefab"); //if(Prefab != null) //{ // LCustomizedCharacterSamples = GameObject.FindGameObjectsWithTag("Prefab_Hero"); //} rolateObject = GetComponentInChildren <RolateObject>(); // SetCuurentHero(); currentAnimatorAction = AnimatorAction.Idle; ShowPanel(PanelType.HeroPanel); InitHeroHead(); InitDropDown(); }
public void SingleTarget() { AnimeAction targetAction = CreateCastAction("fire", "Fire", enemyAnimator, 1000); AnimatorAction animeAction = new AnimatorAction(); animeAction.name = "character"; animeAction.animator = charAnimator; animeAction.triggerState = "Cast"; animeAction.onHitAction = targetAction; //AnimeAction action = actionManager.RunAction(animeAction); }
public void OnPlayAnimation(AnimatorAction _actionType, int _intValue = 1, float _floatValue = 0.0f) { if (animatorParameters != AnimatorParameters.NULL)//说明当前有一个动作被勾选,需要重置 { OnPlayAnimation(animatorParameters, ActionParamtersType.Bool, 0); animatorParameters = AnimatorParameters.NULL; } animatorAction = _actionType; //先重置为idle状态,比如飞行状态播放其他动作必须flyidle始终勾选 OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Idle), ActionParamtersType.Bool, _intValue); switch (_actionType) { case AnimatorAction.Idle: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Idle), ActionParamtersType.Bool, _intValue); break; case AnimatorAction.Walk: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Walk), ActionParamtersType.Bool, _intValue); break; case AnimatorAction.Run: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Run), ActionParamtersType.Bool, _intValue); break; case AnimatorAction.Attack: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Attack), ActionParamtersType.Trigger, _intValue); break; case AnimatorAction.Die: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Die), ActionParamtersType.Trigger, _intValue); break; case AnimatorAction.Hit: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Hit), ActionParamtersType.Trigger, _intValue); break; case AnimatorAction.Stunned: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Stunned), ActionParamtersType.Bool, _intValue); break; case AnimatorAction.Victory: OnPlayAnimation(GetAnimatorParametersByName(animationTableData.Victory), ActionParamtersType.Bool, _intValue); break; default: break; } }
public void CharCast() { AnimatorAction action; action = new AnimatorAction(); action.name = "character"; action.animator = charAnimator; action.triggerState = "Cast"; AnimatorAction fireAction = new AnimatorAction(); fireAction.name = "vfx2"; fireAction.animator = animator2; fireAction.triggerState = "Fire"; action.onHitAction = fireAction; actionManager.RunAction(action); }
public void InitAIBaseByEnity(Enity enity) { this.enity = enity; selfType = enity.enityType; attackType = EnityManager.GetInstance().GetAttackEnityType(selfType); isCanMove = enity.enityType == EnityType.Hero; searchRadius = DataManager.instance.GetConfigValueToFloat("fight_search_radius"); moveSpeed = DataManager.instance.GetConfigValueToFloat("fight_move_speed"); moveAnimatorType = AnimatorAction.Run; animator = enity.gameObject.GetComponent <Animator>(); //////////////////////////判断是否装备武器/////////////////////////////////// Item equip = enity.GetEnityEquip(); if (equip != null) { aiWeapon = gameObject.AddComponent <AIWeapon>(); aiWeapon.InitWeaponByEquip(equip); } isInit = true; }
public AnimeAction GetTargetHitDamageAction() { SequenceAction sequence = new SequenceAction(); sequence.name = "HitSequence"; AnimatorAction hitAction = new AnimatorAction(); hitAction.name = "enemyHit"; hitAction.animator = target; hitAction.triggerState = "Hit"; sequence.AddAction(hitAction); HitValueAction damageAction = new HitValueAction(); damageAction.valueTextPrefab = hitValuePrefab; damageAction.hitValue = 1000; damageAction.position = target.transform.position + new Vector3(0, 1, -2); sequence.AddAction(damageAction); return(sequence); }
public static AnimationBase GetAnimationBase(int type, GameObject go) { ZTAnimationType animationType = ZTAnimationType.Animator; AnimationBase baseAction = null; if (System.Enum.IsDefined(typeof(ZTAnimationType), type)) { animationType = (ZTAnimationType)type; } switch (animationType) { case ZTAnimationType.Animation: baseAction = new AnimationAction(go); break; case ZTAnimationType.Animator: baseAction = new AnimatorAction(go); break; } return(baseAction); }
public void CastProjectile() { // Using ObjectMove ObjectMoveAction projectAction = new ObjectMoveAction(); projectAction.startPosition = player.GetLaunchPosition() + new Vector3(0, 0, zOrderVfx);; projectAction.endPosition = enemyAnimator.transform.position + new Vector3(0, 1, zOrderVfx); projectAction.objectPrefab = projectilePrefab; projectAction.SetDuration(0.5f); SimpleAnimationAction explodeAction = new SimpleAnimationAction(); explodeAction.clip = animeClip; explodeAction.spawnPosition = enemyAnimator.transform.position + new Vector3(0, 0, zOrderVfx); explodeAction.repeat = 1; SequenceAction fullFireAction = new SequenceAction(); fullFireAction.AddAction(projectAction); fullFireAction.AddAction(explodeAction); // Using MoveAction // MoveAction moveAction = new MoveAction(); // moveAction.startPosition = player.GetLaunchPosition(); // moveAction.endPosition = enemyAnimator.transform.position + new Vector3(0, 1, 0); // moveAction.targetObject = testObject; // moveAction.SetDuration(0.5f); AnimatorAction animeAction = new AnimatorAction(); animeAction.name = "character"; animeAction.animator = charAnimator; animeAction.triggerState = "Cast"; animeAction.onHitAction = fullFireAction; actionManager.RunAction(animeAction); }
public void SequenceTest() { List <AnimeAction> actionList = new List <AnimeAction>(); AnimatorAction action; action = new AnimatorAction(); action.name = "vfx1"; action.animator = animator1; action.triggerState = "Thunder"; actionList.Add(action); action = new AnimatorAction(); action.name = "vfx2"; action.animator = animator2; action.triggerState = "Fire"; actionList.Add(action); DelayAction delay = new DelayAction(); delay.SetDuration(1.0f); actionList.Add(delay); action = new AnimatorAction(); action.name = "vfx3"; action.animator = animator1; action.triggerState = "Thunder"; actionList.Add(action); SequenceAction sequence = new SequenceAction(); sequence.name = "sequence"; sequence.AddActionList(actionList); actionManager.RunAction(sequence); //action.animator = bat }
public AnimeAction CreateCastAction(string name, string vfx, Animator target, int damage) { SequenceAction sequence = new SequenceAction(); sequence.name = name; Vector3 targetPosition = target.transform.position; AnimatorAction animeAction; VFXAction vfxAction = new VFXAction(); vfxAction.name = "vfxAction"; vfxAction.vfxName = vfx; vfxAction.position = targetPosition + new Vector3(0, 0, -2); vfxAction.vfxPrefab = vfxPrefab; sequence.AddAction(vfxAction); animeAction = new AnimatorAction(); animeAction.name = "enemyHit"; animeAction.animator = target; animeAction.triggerState = "Hit"; sequence.AddAction(animeAction); HitValueAction hitAction = new HitValueAction(); hitAction.valueTextPrefab = hitValuePrefab; hitAction.hitValue = damage; hitAction.position = targetPosition + new Vector3(0, 1, -2); sequence.AddAction(hitAction); return(sequence); }