public override void _Ready() { _aTree = GetNode <AnimationTree>("AnimationTree"); _sword = GetNode <Sword>("Sword"); _aTreePlayback = (AnimationNodeStateMachinePlayback)_aTree.Get("parameters/AnimationNodeStateMachine/playback"); }
public override void _Ready() { _animationTree = GetNode <AnimationTree>("AnimationTree"); _playerModel = GetNode <Spatial>("PlayerModel"); _shootFrom = _playerModel.GetNode <Position3D>(@"Robot_Skeleton/Skeleton/GunBone/ShootFrom"); _colorRect = GetNode <ColorRect>("ColorRect"); _crosshair = GetNode <TextureRect>("Crosshair"); _fireCooldown = GetNode <Timer>("FireCooldown"); _cameraBase = GetNode <Spatial>("CameraBase"); _cameraAnimation = _cameraBase.GetNode <AnimationPlayer>(@"Animation"); _cameraRot = _cameraBase.GetNode <Spatial>(@"CameraRot"); _cameraSpringArm = _cameraRot.GetNode <SpringArm>(@"SpringArm"); _cameraCamera = _cameraSpringArm.GetNode <CameraNoiseShakeEffect>(@"Camera"); _soundEffects = GetNode <Node>("SoundEffects"); _soundEffectJump = _soundEffects.GetNode <AudioStreamPlayer>(@"Jump"); _soundEffectLand = _soundEffects.GetNode <AudioStreamPlayer>(@"Land"); _soundEffectShoot = _soundEffects.GetNode <AudioStreamPlayer>(@"Shoot"); _initialPosition = Transform.origin; _gravity = Convert.ToSingle(ProjectSettings.GetSetting("physics/3d/default_gravity")) * (Vector3)ProjectSettings.GetSetting("physics/3d/default_gravity_vector"); // Pre-initialize orientation transform. _orientation = _playerModel.GlobalTransform; _orientation.origin = new Vector3(); }
void UpdateAnimationTree() { if (EntitySystemWorld.Instance.Simulation && !EntitySystemWorld.Instance.SystemPauseOfSimulation) { AnimationTree tree = GetFirstAnimationTree(); if (tree != null) { tree.SetParameterValue("weapon", activeWeapon != null ? 1 : 0); Radian horizontalAngle = 0; Radian verticalAngle = 0; PlayerIntellect playerIntellect = Intellect as PlayerIntellect; if (playerIntellect != null) { Vec2 vec = Vec2.Zero; vec.X += playerIntellect.GetControlKeyStrength(GameControlKeys.Forward); vec.X -= playerIntellect.GetControlKeyStrength(GameControlKeys.Backward); vec.Y += playerIntellect.GetControlKeyStrength(GameControlKeys.Left); vec.Y -= playerIntellect.GetControlKeyStrength(GameControlKeys.Right); if (vec.X < 0) { vec = -vec; } horizontalAngle = MathFunctions.ATan(vec.Y, vec.X); verticalAngle = playerIntellect.LookDirection.Vertical; } tree.SetParameterValue("weaponHorizontalAngle", horizontalAngle.InDegrees()); tree.SetParameterValue("weaponVerticalAngle", verticalAngle.InDegrees()); } } }
// Called when the node enters the scene tree for the first time. public override void _Ready() { animator = GetNode <AnimationPlayer>("Animation"); animatorTree = GetNode <AnimationTree>("AnimationTree"); animatorState = (AnimationNodeStateMachinePlayback)animatorTree.Get("parameters/playback"); animatorTree.Active = true; }
public AnimationStateManager( AnimationPlayer player, AnimationTree animationTree, Option <IAnimationGraphFactory> graphFactory, Option <IAnimationControlFactory> controlFactory, ProcessMode processMode, ITimeSource timeSource, bool active, ILoggerFactory loggerFactory) : base(player, processMode, timeSource, active, loggerFactory) { Ensure.That(animationTree, nameof(animationTree)).IsNotNull(); AnimationTree = animationTree; GraphFactory = graphFactory.IfNone(() => new AnimationGraphFactory()); ControlFactory = controlFactory.IfNone(() => new AnimationControlFactory()); Context = new AnimationGraphContext( Player, AnimationTree, OnAdvance, GraphFactory, ControlFactory, loggerFactory); _graph = GraphFactory.TryCreate((AnimationRootNode)AnimationTree.TreeRoot, Context).IfNone(() => throw new ArgumentException( "Failed to create animation graph from the specified animation tree.", nameof(animationTree))); AnimationTree.ProcessMode = AnimationTree.AnimationProcessMode.Manual; this.LogDebug("Using graph factory: {}.", GraphFactory); this.LogDebug("Using control factory: {}.", ControlFactory); }
void UpdateAnimationTree() { if (EntitySystemWorld.Instance.Simulation && !EntitySystemWorld.Instance.SystemPauseOfSimulation) { AnimationTree tree = GetFirstAnimationTree(); if (tree != null) { bool onGround = GetElapsedTimeSinceLastGroundContact() < .2f; //IsOnGround(); bool move = false; Degree moveAngle = 0; float moveSpeed = 0; if (onGround && GroundRelativeVelocitySmooth.ToVec2().Length() > .05f) { move = true; Vec2 localVec = (Rotation.GetInverse() * GroundRelativeVelocity).ToVec2(); Radian angle = MathFunctions.ATan(localVec.Y, localVec.X); moveAngle = angle.InDegrees(); moveSpeed = GroundRelativeVelocity.ToVec2().Length(); } tree.SetParameterValue("move", move ? 1 : 0); tree.SetParameterValue("run", move && IsNeedRun() ? 1 : 0); tree.SetParameterValue("moveAngle", moveAngle); tree.SetParameterValue("moveSpeed", moveSpeed); tree.SetParameterValue("fly", !onGround ? 1 : 0); } } }
public AnimationDrivenLocomotion( AnimationTree animationTree, Skeleton skeleton, AnimationStates states, Blender2D blender, TimeScale timeScale, string idleState, string moveState, KinematicBody target, Physics3DSettings physicsSettings, ITimeSource timeSource, bool active, ILoggerFactory loggerFactory) : base(target, physicsSettings, timeSource, active, loggerFactory) { Ensure.That(animationTree, nameof(animationTree)).IsNotNull(); Ensure.That(skeleton, nameof(skeleton)).IsNotNull(); Ensure.That(states, nameof(states)).IsNotNull(); Ensure.That(blender, nameof(blender)).IsNotNull(); Ensure.That(timeScale, nameof(timeScale)).IsNotNull(); Ensure.That(idleState, nameof(idleState)).IsNotNullOrEmpty(); Ensure.That(moveState, nameof(moveState)).IsNotNullOrEmpty(); AnimationTree = animationTree; Skeleton = skeleton; States = states; Blender = blender; TimeScale = timeScale; IdleState = idleState; MoveState = moveState; }
public override void _Ready() { base._Ready(); _animationTree = (AnimationTree)GetNodeOrNull("AnimationTree"); _stateMachine = (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/playback"); AddFloatDelegate(MouseFollowerDelegateManager.Group.BLINK_SPEED_MODIFIER, ModifyBlinkSpeed); }
protected override Vector3 KinematicProcess(float delta, Vector3 velocity, Vector3 rotationalVelocity) { var speed = velocity.Length(); var direction = velocity.Normalized(); var current = States.State; if (speed > 0) { if (current == IdleState) { States.State = MoveState; } Blender.Position = new Vector2(direction.x, -direction.z) * speed; TimeScale.Speed = Mathf.Max(1, speed); } else if (current == MoveState) { States.State = IdleState; } var t = AnimationTree.GetRootMotionTransform(); var offset = Skeleton.GlobalTransform.Xform(t.origin) - Skeleton.GlobalTransform.origin; return(offset / delta); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { _animTree = GetNode <AnimationTree>("AnimationTree"); _animTree.Active = true; stateMachine = (AnimationNodeStateMachinePlayback)_animTree.Get("parameters/StateMachine/playback"); state = new AmandaIdle(this); fallingTimer = GetNode <Timer>("FallingTimer"); }
public override void _Ready() { _AnimationTree = GetNode <AnimationTree>("AnimationTree"); _AnimationTree.Active = true; StateMachineArms = (AnimationNodeStateMachinePlayback)_AnimationTree.Get("parameters/StateMachine/playback"); Walk = 0f; Jump = Land = Fall = Retract = false; }
// Called when the node enters the scene tree for the first time. public override void _Ready() { initValues(); currentSprite = GetNode <Sprite>("Sprite"); animTree = GetNode <AnimationTree>("AnimationTree"); animTree.Active = true; }
public override void _Ready() { playerStats = (Stats)GetNode("/root/PlayerStats"); playerStats.Connect("NoHealth", this, "queue_free"); blinkAnimationPlayer = (AnimationPlayer)GetNode("BlinkAnimationPlayer"); animationTree = (AnimationTree)GetNode("AnimationTree"); animationTree.Active = true; playerAnimationState = (AnimationNodeStateMachinePlayback)animationTree.Get("parameters/playback"); //These pins are added to the player inventory temporarily for testing. They will be removed later. (string abilityAddress, string userAnimation, bool passive) = AbilityCatalog.SwordSwipe(); PlayerPins.Add(new Pin { AbilityAddress = abilityAddress, UserAnimation = userAnimation, Passive = passive, Level = 1, EXP = 0, Quality = 0, SlotNum = 1 }); (abilityAddress, userAnimation, passive) = AbilityCatalog.Fireball(); PlayerPins.Add(new Pin { AbilityAddress = abilityAddress, UserAnimation = userAnimation, Passive = passive, Level = 1, EXP = 0, Quality = 0, SlotNum = 2 }); (abilityAddress, userAnimation, passive) = AbilityCatalog.Thing(); PlayerPins.Add(new Pin { AbilityAddress = abilityAddress, UserAnimation = userAnimation, Passive = passive, Level = 1, EXP = 0, Quality = 0, SlotNum = 3 }); (abilityAddress, userAnimation, passive) = AbilityCatalog.StandHeal(); PlayerPins.Add(new Pin { AbilityAddress = abilityAddress, UserAnimation = userAnimation, Passive = passive, Level = 1, EXP = 0, Quality = 0, SlotNum = 6 }); SlotSets = BuildSlotSets(PlayerPins); LoadAbilities(SlotSets[currentSlotSet]); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { _playerSprite = GetNode <Sprite>("Sprite"); _animationPlayer = GetNode <AnimationPlayer>("AnimationPlayer"); _animationTree = GetNode <AnimationTree>("AnimationTree"); _stateMachine = (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/playback"); _animationTree.Active = true; _stateMachine.Start("idle"); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { _anim = GetNode <AnimationPlayer>("Anim"); _animationTree = GetNode <AnimationTree>("AnimationTree"); _animationStateMachine = _animationTree.Get("parameters/StateMachine/playback") as AnimationNodeStateMachinePlayback; // _animationNodeTimeScale = _animationTree.Get("parameters/TimeScale/scale") as AnimationNodeTimeScale; _animationTree.Set("parameters/TimeScale/scale", 1 / MoveTime); _tween = GetNode <Tween>("Tween"); }
public override void _Ready() { animationTree = (AnimationTree)GetNode("AnimationTree"); animationTree.Active = true; animationState = (AnimationNodeStateMachinePlayback)animationTree.Get("parameters/playback"); hitbox = (HitboxSword)GetNode("HitboxPivot/HitboxSword"); hitbox.KnockbackVector = KnockbackVector * KnockbackPower; hitbox.Damage = AttackPower; }
public override void _Ready() { moveAnimation = GetNode <AnimationTree>("Anim/Move"); facingAnimation = GetNode <AnimationTree>("Anim/Facing"); Claw = GetNode <Hand>("Hand"); feet = GetNode <Position2D>("Feet"); moveAnimation.Active = true; facingAnimation.Active = true; PixelCamera.Instance.Rexy = this; }
public override void _Process(float delta) { if (_player != null) { var direction = Position.DirectionTo(_player.Position); AnimationTree.Set("parameters/Run/blend_position", direction); AnimationTree.Set("parameters/Idle/blend_position", direction); } }
//private SpeechSynthesizer voice; // Called when the node enters the scene tree for the first time. public override void _Ready() { speachPlayer = GetNode <AudioStreamPlayer3D>("SpeachPlayer"); animationTree = GetNode <AnimationTree>("AnimationTree"); //voice = new SpeechSynthesizer(); //voice.Rate = -1; //voice.VisemeReached += VisemeReached; //SetLanguage(); }
int HEALTH = 3 + 1; // idk why he takes damage instantly when spawning // Called when the node enters the scene tree for the first time. public override void _Ready() { audio = GetNode <AudioStreamPlayer>("AudioStreamPlayer"); audio.VolumeDb = 3; animationPlayer = GetNode <AnimationPlayer>("AnimationPlayer"); animationTree = GetNode <AnimationTree>("AnimationTree"); animationTree.Active = true; animationState = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback; playerDetection = GetNode <Area2D>("PlayerDetection") as PlayerDetection; }
// Called when the node enters the scene tree for the first time. public override void _Ready() { this.cameraPivot = FindNode("CameraPivot", true, true) as Spatial; this.camera = FindNode("Camera", true, true) as Camera; this.armature = FindNode("Armature", true, true) as Spatial; this.animationTree = FindNode("AnimationTree", true, true) as AnimationTree; this.animationPlayer = FindNode("AnimationPlayer", true, true) as AnimationPlayer; Input.SetMouseMode(Input.MouseMode.Captured); }
public override void _Ready() { base._Ready(); Player = GetNode <Player>("../.."); AnimatedSprite = GetNode <AnimatedSprite>("../../AnimatedSprite"); AnimationTree = GetNode <AnimationTree>("../../AnimationTree"); StateMachine = AnimationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback; AnimatedSprite.Play(); }
// Called when the node enters the scene tree for the first time. public override void _Ready() { Anim = GetNode <AnimationPlayer>("AnimationPlayer"); AnimTree = GetNode <AnimationTree>("AnimationTree"); AnimStateMachine = AnimTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback; AnimTree.Active = true; Game = GetTree().Root.GetNode <Game>("Game"); // GroundMap = Game.GetNode<TileMap>("Ground"); // RayCastAStar = new RayCastAStar(GroundMap, GetWorld2d().DirectSpaceState); }
private bool IsAllowUpdateControlledObject() { //bad for system with disabled renderer, because here game logic depends animation. AnimationTree tree = Owner.ControlledObject.GetFirstAnimationTree(); if (tree != null && tree.GetActiveTriggers().Count != 0) { return(false); } return(true); }
public override void _Ready() { _Camera = (Camera)Owner.FindNode("Camera"); PlayerCollision = (CollisionShape)FindNode("Collision"); PlayerTriggerArea = (Area)FindNode("PlayerArea"); PlayerTriggerArea.Connect("area_entered", this, "CheckTriggerAreaEnterCollision"); PlayerTriggerArea.Connect("area_exited", this, "CheckTriggerAreaExitCollision"); PlayerAnimationsTree = (AnimationTree)FindNode("AnimationTree"); manager = (GameManager)Owner; CanLook = true; CanMove = true; }
public override void _Ready() { this.Sprite = this.GetNode <Sprite>("Sprite"); this.AnimationTree = this.GetNode <AnimationTree>("AnimationTree"); this.AnimationStateMachine = (AnimationNodeStateMachinePlayback)this.AnimationTree.Get("parameters/playback"); this.DisableTimer = this.GetNode <Timer>("DisableTimer"); this.JumpSound = this.GetNode <AudioStreamPlayer>("Audio/Jump"); this.PunchSound = this.GetNode <AudioStreamPlayer>("Audio/Punch"); this.ChompSound = this.GetNode <AudioStreamPlayer>("Audio/Chomp"); this.Animate(State.Idle); }
public override void _Ready() { base._Ready(); body2D = this as KinematicBody2D; sprite = GetNode("Sprite") as Sprite; animationPlayer = GetNode("AnimationPlayer") as AnimationPlayer; animationTree = GetNode("AnimationTree") as AnimationTree; animationPlayback = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback; animationPlayback.Start("idle"); }
/// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary> protected override void OnPostCreate(bool loaded) { base.OnPostCreate(loaded); SubscribeToTickEvent(); //play death animation AnimationTree tree = GetFirstAnimationTree(); if (tree != null) { tree.ActivateTrigger("death"); } }
public override void _Ready() { OwnerMob = (Mob)Owner; Actions = OwnerMob.Actions; AnimationTree = OwnerMob.GetNode <AnimationTree>("Animation/AnimationTree"); AnimationState = AnimationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback; HurtAnimationDelayTimer = new Timer(); HurtAnimationDelayTimer.Name = "HurtAnimationDelayTimer"; HurtAnimationDelayTimer.WaitTime = 0.2f; AddChild(HurtAnimationDelayTimer); }
protected override void OnRenderFrame() { //update animation tree if (EntitySystemWorld.Instance.Simulation && !EntitySystemWorld.Instance.SystemPauseOfSimulation) { AnimationTree tree = GetFirstAnimationTree(); if (tree != null) { UpdateAnimationTree(tree); } } base.OnRenderFrame(); }
// Draw the GUI used for selecting animation trees void DrawAnimTreeSelectionGUI() { EditorGUIUtility.LookLikeControls (); string[] trees = new string[m_activeAnimationTrees.Length + 2]; trees[0] = "None"; trees[1] = ""; int counter = 2; int selected = 0; foreach (AnimationTree tree in m_activeAnimationTrees) { if (tree != null) { trees[counter] = tree.name; if (m_selectedAnimationTree == tree) { selected = counter; } counter++; } } GUILayout.Label("Animation Tree:", GUILayout.ExpandWidth(false)); int newSel = EditorGUILayout.Popup(selected, trees, GUILayout.ExpandWidth(false)); if (newSel != selected) { if (newSel <= 1) { Selection.activeGameObject = null; } else { Selection.activeGameObject = m_activeAnimationTrees[newSel-2].gameObject; } m_controlVarsWindow = null; m_activeContainer = null; m_selectedAnimationTree = null; m_Windows.Clear(); } }
public void Update() { if ( m_selectedAnimationTree != null && m_selectedAnimationTree.IsDirty ) { CheckForDirtyNodes(m_selectedAnimationTree.Root); m_selectedAnimationTree.IsDirty = false; } if ( Selection.activeGameObject != null ) { // Get the current selection from Unity GameObject go = Selection.activeGameObject; // Get the tree the current selection belongs to AnimationTree currentTree = GetAnimationTree( go ); // If a child of an animation tree is currently selected... if (currentTree != null) { GameObject firstChild = go; // Make sure the firstChild points to an AT_Node not the AnimationTree base object if (currentTree.gameObject == go ) { firstChild = currentTree.Root.gameObject; } m_currentNode = firstChild.GetComponent<AT_Node>(); AT_ContainerNode contParent; // If the root is not selected, find the closest container node to the selected node if (firstChild != currentTree.Root.gameObject) { if (m_currentNode != null && m_currentNode.Parent != null) { contParent = FindNextContainerNode(m_currentNode.Parent.gameObject); } else { contParent = FindNextContainerNode(firstChild.transform.parent.gameObject); } } else { // If the root is selected, it is the active container contParent = firstChild.GetComponent<AT_ContainerNode>(); } // Change the control variables node's parent to the currently selected container. // This allows us to view and select the control variables node while inside any // container node without altering what the active container node is if (m_selectedAnimationTree != null && m_activeContainer != null) { m_selectedAnimationTree.m_controlVarsNode.Parent = m_activeContainer; } // If we've selected a new container node, rebuild the tree graph if ( contParent != m_activeContainer ) { m_activeContainer = contParent; RebuildTreeGraph(); } // If the control variables window doesn't exist, create it if (m_controlVarsWindow == null) { RefreshVariablesWindow(); } } m_selectedAnimationTree = currentTree; } else { m_selectedAnimationTree = null; } }
public void Init( EditorWindow window ) { // Load in texture resources m_lineTexture = ( Texture2D )Resources.Load( "Line Texture 2" ); m_arrowTexture = ( Texture2D )Resources.Load( "ArrowHead" ); m_icons = new Texture2D[6]; m_icons[0] = (Texture2D)Resources.Load("Icon - StateMachine"); m_icons[1] = (Texture2D)Resources.Load("Icon - BlendGraph"); m_icons[2] = (Texture2D)Resources.Load("Icon - Animation"); m_icons[3] = (Texture2D)Resources.Load("Icon - Blend"); m_icons[4] = (Texture2D)Resources.Load("Icon - AddBlend"); m_icons[5] = (Texture2D)Resources.Load("Icon - Pose"); // Init editor to safe state m_editorWindow = window; m_selectedAnimationTree = null; m_Windows.Clear(); m_activeContainer = null; ActiveWindow = null; Dragging = false; ConnectionStart = null; ConnectionEnd = null; m_camerScaleAmount = new Vector2(1, 1); // Find all the enabled animation trees m_activeAnimationTrees = GameObject.FindObjectsOfType(typeof(AnimationTree)) as AnimationTree[]; }
protected virtual void OnClone(AnimationTree.Block source);
protected virtual void OnDeleteBlock(AnimationTree.Block block);
public void DeleteBlock(AnimationTree.Block block);
void UpdateAnimationTree( AnimationTree tree ) { bool move = false; //Degree moveAngle = 0; float moveSpeed = 0; if( mainBodyVelocity.ToVec2().LengthFast() > .1f ) { move = true; moveSpeed = ( Rotation.GetInverse() * mainBodyVelocity ).X; } tree.SetParameterValue( "move", move ? 1 : 0 ); //tree.SetParameterValue( "moveAngle", moveAngle ); tree.SetParameterValue( "moveSpeed", moveSpeed ); }
public void SetAnimationSource(int index, AnimationTree.AnimationListBlock block);
public void ResetItemsTimePosition(AnimationTree.AnimationListOutput output);
public AnimationListOutput(AnimationTree tree);
protected override void OnDeleteBlock(AnimationTree.Block block);
protected override void OnClone(AnimationTree.Block source);