public override void _Ready() { base._Ready(); // get references to scene components to be used _attackTimer = GetNode <Timer>("AttackTimer"); // load packed scenes _weaponPS = (PackedScene)ResourceLoader.Load("res://MeleeCarry1/MeleeCarry1_weapon.tscn"); _markWavePS = (PackedScene)ResourceLoader.Load("res://MeleeCarry1/MarkWave.tscn"); _totemPS = (PackedScene)ResourceLoader.Load("res://MeleeCarry1/TeleportationTotem.tscn"); // get spawn positions _leftSwordSpawn = GetNode <Position3D>("Armature/Skeleton/headAttachment/LeftSwordSpawnPoint"); _rightSwordSpawn = GetNode <Position3D>("Armature/Skeleton/headAttachment/RightSwordSpawnPoint"); _waveSpawn = GetNode <Position3D>("Armature/Skeleton/headAttachment/MarkWaveSpawnPoint"); // connect interaction area to body for sword pickup GetNode <Area>("InteractionArea").Connect("area_entered", this, "InteractionCallback"); // setup references to state machine _stateMachineController = (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/stateMachine/playback"); AnimationNodeBlendTree treeRoot = (AnimationNodeBlendTree)_animationTree.TreeRoot; AnimationNodeStateMachine stateMachineChild = (AnimationNodeStateMachine)treeRoot.GetNode("stateMachine"); _stateMachine = new AnimationStateMachine(stateMachineChild, _stateMachineController); }
public override void _Ready() { base._Ready(); // initialize gun clips _leftGunAmmo = _gunClipSize; _rightGunAmmo = _gunClipSize; // setup references for left and right state machines AnimationNodeBlendTree treeRoot = (AnimationNodeBlendTree)_animationTree.TreeRoot; AnimationNodeStateMachine leftMainStateMachine = (AnimationNodeStateMachine)treeRoot.GetNode("leftMainStateMachine"); _leftMainStateMachine = new AnimationStateMachine(leftMainStateMachine, (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/leftMainStateMachine/playback")); AnimationNodeStateMachine rightStateMachine = (AnimationNodeStateMachine)treeRoot.GetNode("rightStateMachine"); _rightStateMachine = new AnimationStateMachine(rightStateMachine, (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/rightStateMachine/playback")); }