/// <summary> /// Creates automatically a die behaviour rule. /// </summary> /// <param name="_control">Control.</param> /// <param name="_key">Key.</param> public static void CreateBehaviourRuleDie(ICECreatureControl _control, BehaviourModeObject _behaviour) { if (_behaviour == null) { return; } _behaviour.NextRule(); if (_behaviour.Rule != null) { _behaviour.Rule.Move.Enabled = false; _behaviour.Rule.Move.Foldout = false; _behaviour.Rule.Move.Motion.Velocity = Vector3.zero; _behaviour.Rule.Move.Motion.AngularVelocity = Vector3.zero; if (!_control.Creature.Essentials.IgnoreAnimationDead) { _behaviour.Rule.Animation.Copy(_control.Creature.Essentials.AnimationDead); _behaviour.Rule.Animation.Enabled = true; _behaviour.Rule.Animation.Foldout = true; } else if (!_control.Creature.Essentials.IgnoreAnimationIdle) { _behaviour.Rule.Animation.Copy(_control.Creature.Essentials.AnimationIdle); _behaviour.Rule.Animation.Enabled = true; _behaviour.Rule.Animation.Foldout = true; } } }
/// <summary> /// Creates automatically an walk behaviour rule. /// </summary> /// <param name="_control">Control.</param> /// <param name="_key">Key.</param> public static void CreateBehaviourRuleWalk(ICECreatureControl _control, BehaviourModeObject _behaviour) { if (_behaviour == null) { return; } _behaviour.NextRule(); if (_behaviour.Rule != null) { _behaviour.Rule.Move.Enabled = true; _behaviour.Rule.Move.Foldout = true; _behaviour.Rule.Move.Motion.AngularVelocity.y = _control.Creature.Essentials.DefaultTurningSpeed; if (!_control.Creature.Essentials.IgnoreAnimationWalk) { _behaviour.Rule.Move.Motion.Velocity.z = _control.Creature.Essentials.DefaultWalkingSpeed; _behaviour.Rule.Animation.Copy(_control.Creature.Essentials.AnimationWalk); _behaviour.Rule.Animation.Enabled = true; _behaviour.Rule.Animation.Foldout = true; } else if (!_control.Creature.Essentials.IgnoreAnimationRun) { _behaviour.Rule.Move.Motion.Velocity.z = _control.Creature.Essentials.DefaultRunningSpeed; _behaviour.Rule.Animation.Copy(_control.Creature.Essentials.AnimationRun); _behaviour.Rule.Animation.Enabled = true; _behaviour.Rule.Animation.Foldout = true; } else { _behaviour.Rule.Move.Motion.Velocity.z = _control.Creature.Essentials.DefaultWalkingSpeed; } } }
/// <summary> /// Creates automatically an attack behaviour rule. /// </summary> /// <param name="_control">Control.</param> /// <param name="_key">Key.</param> public static void CreateBehaviourRuleAttack(ICECreatureControl _control, BehaviourModeObject _behaviour) { if (_behaviour == null) { return; } _behaviour.NextRule(); if (_behaviour.Rule != null) { _behaviour.Rule.Move.Enabled = true; _behaviour.Rule.Move.Foldout = true; _behaviour.Rule.Move.Motion.Velocity = Vector3.zero; _behaviour.Rule.Move.Motion.AngularVelocity.y = _control.Creature.Essentials.DefaultTurningSpeed; _behaviour.Rule.Move.ViewingDirection = ViewingDirectionType.CENTER; if (!_control.Creature.Essentials.IgnoreAnimationAttack) { _behaviour.Rule.Animation.Copy(_control.Creature.Essentials.AnimationAttack); _behaviour.Rule.Animation.Enabled = true; _behaviour.Rule.Animation.Foldout = true; } } }
public static bool WizardAnimation(ICECreatureControl _control, BehaviourModeObject _behaviour) { if (_behaviour == null) { return(false); } _behaviour.NextRule(); if (_behaviour.Rule == null) { return(false); } if (_behaviour.Key == "RUN" || _behaviour.Key == "TRAVEL" || _behaviour.Key == "JOURNEY" || _behaviour.Key == "HUNT" || _behaviour.Key == "ESCAPE" || _behaviour.Key == "FLEE") { _behaviour.Rule.Move.Enabled = true; _behaviour.Rule.Move.Motion.Velocity.z = _control.Creature.Essentials.DefaultRunningSpeed; _behaviour.Rule.Move.Motion.AngularVelocity.y = _control.Creature.Essentials.DefaultTurningSpeed; } else if (_behaviour.Key == "WALK" || _behaviour.Key == "LEISURE" || _behaviour.Key == "AVOID") { _behaviour.Rule.Move.Enabled = true; _behaviour.Rule.Move.Motion.Velocity.z = _control.Creature.Essentials.DefaultWalkingSpeed; _behaviour.Rule.Move.Motion.AngularVelocity.y = _control.Creature.Essentials.DefaultTurningSpeed; } else { _behaviour.Rule.Move.Enabled = false; _behaviour.Rule.Move.Motion.Velocity.z = 0; _behaviour.Rule.Move.Motion.AngularVelocity.y = 0; } if (_control.GetComponent <Animator>() != null && _control.GetComponent <Animator>().runtimeAnimatorController != null) { AnimationClip[] _clips = AnimationTools.GetAnimationClips(_control.GetComponent <Animator>()); int _index = 0; foreach (AnimationClip _clip in _clips) { if (AnimationIsSuitable(_behaviour.Key, _clip.name)) { _behaviour.Rule.Animation.InterfaceType = AnimationInterfaceType.MECANIM; _behaviour.Rule.Animation.Animator.Type = AnimatorControlType.DIRECT; _behaviour.Rule.Animation.Animator.Name = _clip.name; _behaviour.Rule.Animation.Animator.Index = _index; break; } _index++; } } else if (_control.GetComponentInChildren <Animation>() != null) { Animation _animation = _control.GetComponentInChildren <Animation>(); int _index = 0; foreach (AnimationState _state in _animation) { if (AnimationIsSuitable(_behaviour.Key, _state.name)) { _behaviour.Rule.Animation.InterfaceType = AnimationInterfaceType.LEGACY; _behaviour.Rule.Animation.Animation.Name = _state.name; _behaviour.Rule.Animation.Animation.Index = _index; } _index++; } } return(true); }