Example #1
0
 // 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;
 }
Example #2
0
    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);
    }
Example #3
0
    //  // Called every frame. 'delta' is the elapsed time since the previous frame.
    //  public override void _Process(float delta)
    //  {
    //
    //  }
    public override void _PhysicsProcess(float delta)
    {
        Vector2 inputVector = Vector2.Zero;

        animationState = (AnimationNodeStateMachinePlayback)animationTree.Get("parameters/playback");

        inputVector.x = Input.GetActionStrength("ui_right") - Input.GetActionStrength("ui_left");
        inputVector.y = Input.GetActionStrength("ui_down") - Input.GetActionStrength("ui_up");
        inputVector   = inputVector.Normalized();

        if (inputVector != Vector2.Zero)
        {
            // Set animation tree blend position values based on inputVector value
            animationTree.Set("parameters/Idle/blend_position", inputVector);
            animationTree.Set("parameters/Run/blend_position", inputVector);

            animationState.Travel("Run");
            velocity = velocity.MoveToward(inputVector * MAX_SPEED, ACCELERATION * delta);
        }
        else
        {
            animationState.Travel("Idle");
            // Move
            velocity = velocity.MoveToward(Vector2.Zero, FRICTION * delta);
        }

        velocity = MoveAndSlide(velocity);
    }
Example #4
0
 public override void _Ready()
 {
     _aTree         = GetNode <AnimationTree>("AnimationTree");
     _sword         = GetNode <Sword>("Sword");
     _aTreePlayback =
         (AnimationNodeStateMachinePlayback)_aTree.Get("parameters/AnimationNodeStateMachine/playback");
 }
Example #5
0
 public override void _Ready()
 {
     base._Ready();
     _animationTree = (AnimationTree)GetNodeOrNull("AnimationTree");
     _stateMachine  = (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/playback");
     AddFloatDelegate(MouseFollowerDelegateManager.Group.BLINK_SPEED_MODIFIER, ModifyBlinkSpeed);
 }
Example #6
0
 // 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");
 }
Example #7
0
 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;
 }
Example #8
0
 public override void _Ready()
 {
     motion         = new Vector2();
     gravity       *= frameRate;
     speed         *= frameRate;
     jumpStrength  *= frameRate;
     this.playback  = ((AnimationTree)this.FindNode("AnimationTree")).playback;
     this.direction = Direction.Right;
 }
Example #9
0
    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()
 {
     _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;
 }
Example #12
0
 // 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");
 }
Example #13
0
    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;
    }
Example #14
0
        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();
        }
Example #15
0
    // 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);
    }
Example #16
0
    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");
    }
Example #17
0
    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);
    }
Example #18
0
    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);
    }
Example #19
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     animationPlayer      = GetNode <AnimationPlayer>("AnimationPlayer");
     animationTree        = GetNode <AnimationTree>("AnimationTree");
     gunNode              = GetNode <Node2D>("Gun");
     animationTree.Active = true;
     animationState       = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback;
     bullet        = GD.Load <PackedScene>("res://Player/Bullet.tscn");
     flashbang     = GD.Load <PackedScene>("res://Player/Flashbang.tscn");
     timer         = GetNode <Timer>("Timer");
     flashCooldown = GetNode <Timer>("FlashCooldown");
     walkTimer     = GetNode <Timer>("WalkTimer");
     sound         = GetNode <AudioStreamPlayer>("AudioStreamPlayer");
 }
Example #20
0
        public override void _Ready()
        {
            _stats = GetNode <Stats>("PlayerStats");
            _stats.Connect("NoHealth", this, nameof(Death));

            _animationTree        = GetNode <AnimationTree>("AnimationTree");
            _animationState       = (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/playback");
            _animationTree.Active = true;
            _blinkAnimationPlayer = GetNode <AnimationPlayer>("BlinkAnimationPlayer");

            _hurtBox = GetNode <HurtBox>("HurtBox");

            _walkingStickHitBox = GetNode <WalkingStick>("HitboxPivot/WalkingStickHitBox");
        }
Example #21
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        playerStats = (Stats)GetNode("/root/PlayerStats");
        playerStats.Connect("noHitpoints", this, "_onNoHitPoints");

        rollCdTimer          = ROLL_COOLDOWN;
        swordHitbox          = GetNode <SwordHitbox>("HitboxPivot/SwordHitbox");
        hurtbox              = GetNode <Hurtbox>("Hurtbox");
        animationPlayer      = GetNode <AnimationPlayer>("AnimationPlayer");
        blinkAnimationPlayer = GetNode <AnimationPlayer>("BlinkAnimationPlayer");
        animationTree        = GetNode <AnimationTree>("AnimationTree");
        animationTree.Active = true;
        animationState       = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback;
    }
Example #22
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        playerStats = GetNode <Stats>("/root/PlayerStats");
        playerStats.OnZeroHealth += Die;

        hurtbox = GetNode <Hurtbox>("Hurtbox");
        hurtbox.OnInvincibilityStarted += BlinkStart;
        hurtbox.OnInvincibilityEnded   += BlinkStop;

        animPlayer      = GetNode <AnimationPlayer>("AnimationPlayer");
        animTree        = GetNode <AnimationTree>("AnimationTree");
        animState       = (AnimationNodeStateMachinePlayback)animTree.Get("parameters/playback");
        animTree.Active = true;

        blinkAnimationPlayer = GetNode <AnimationPlayer>("BlinkAnimationPlayer");
    }
Example #23
0
    public void Init()
    {
        Bow    = (Spatial)GetNode("Skeleton/LeftHandAttachment/Bow");
        Arrow  = (Spatial)GetNode("Skeleton/RightHandAttachment/Arrow");
        Pistol = (Spatial)GetNode("Skeleton/RightHandAttachment/Pistol");

        PunchArea          = (Area)GetNode("Skeleton/RightHandAttachment/Area");
        BodyCollisionShape = (CollisionShape)GetNode("CollisionShape");
        BulletRay          = (RayCast)GetNode("BulletRayCast");

        AnimTree     = (AnimationTree)GetNode("AnimationTree");
        StateMachine = (AnimationNodeStateMachinePlayback)AnimTree.Get("parameters/playback");
        ChangeState(State);

        //LeftFootRayCast = (RayCast)GetNode("Skeleton/LeftFootAttachment/RayCast");
        //RightFootRayCast = (RayCast)GetNode("Skeleton/RightFootAttachment/RayCast");
    }
        public override void _Ready()
        {
            base._Ready();
            // Initialize and mount the state machine.
            this._stateMachine = new StateMachine <Player>(this, StatesIndex.Idle);
            this._stateMachine
            .AddState(new PlayerAttackState())
            .AddState(new PlayerMovingState())
            .AddState(new PlayerIdleState());


            this._attackArea = GetNode <AttackArea>("./AttackArea");
            this._attackArea.SetWeapon(new Sword(10, 10));
            // Get Animation components (nodos).
            this._animationTree        = GetNode <AnimationTree>("./AnimationTree");
            this._animationTree.Active = true;
            this._animationNodeStateMachinePlayback =
                (AnimationNodeStateMachinePlayback)this._animationTree.Get("parameters/playback");
        }
Example #25
0
    public override void _Ready()
    {
        base._Ready();

        jumpGravity      = 2.0f * jumpHeight / Mathf.Pow(jumpDuration / 2.0f, 2);
        fallGravity      = 2.0f * jumpHeight / Mathf.Pow(fallDuration / 2.0f, 2);
        jumpSpeed        = -Mathf.Sqrt(2.0f * jumpGravity * jumpHeight);
        terminalVelocity = airborneTerminalVelocity;

        sprite          = GetNode("Sprite") as Sprite;
        animationPlayer = GetNode("AnimationPlayer") as AnimationPlayer;
        animationTree   = GetNode("AnimationTree") as AnimationTree;
        animationTree.SetActive(true);
        animationPlayback = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback;
        animationPlayback.Start("stand");

        hitbox = GetNode("Sprite/Hitbox") as Area2D;
        hitbox.Connect("area_entered", this, "_On_Hitbox_AreaEntered");
    }
Example #26
0
    public override void _Ready()
    {
        _AnimationPlayer     = GetNode <AnimationPlayer>("AnimationPlayer");
        _Sprite              = GetNode <Sprite>("Sprite");
        _AnimationTree       = GetNode <AnimationTree>("AnimationTree");
        _YeetedCatDelayTimer = GetNode <Timer>("YeetedCatDelayTimer");

        _AnimStateMachine = (AnimationNodeStateMachinePlayback)
                            _AnimationTree.Get("parameters/playback");

        _RightWallRaycasts = GetNode <Node2D>("RightWallRaycasts");
        _LeftWallRaycasts  = GetNode <Node2D>("LeftWallRaycasts");

        _YeetedCatPrefab = (PackedScene)GD.Load("res://Scenes/YeetedCat.tscn");

        _Hud = GetNode <HUD>("HUD");

        _AudioStreamPlayer = GetNode <AudioStreamPlayer>("AudioStreamPlayer");
    }
    public override void _Ready()
    {
        moveDirection = Vector3.Zero;

        animationTree = GetNode <AnimationTree>("AnimationTree");
        if (animationTree == null)
        {
            GD.PushError("AnimationTree reference is null!");
        }
        else
        {
            animationTree.Active = true;
            playback             = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback;
        }
        animationPlayer = GetNode <AnimationPlayer>("AnimationPlayer");
        if (animationPlayer == null)
        {
            GD.PushError("AnimationPlayer reference is null!");
        }
    }
Example #28
0
    private AnimationPlayer AnimationPlayerEfectos;                                             //referencia al animation player

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        //para procesar el game manager
        _GameManager = (GameManager)GetTree().GetNodesInGroup("GameManager")[0]; //para poder acceder al GameManager
        _GameManager.AddEnemyToList(this);                                       //tendria que agregarse este mismo objeto kinematico2D


        //para procesar el enemigo
        movementSpeed   = 1f / moveTime;                                                                                          //velocidad a la que se movera
        rayo            = GetNode <RayCast2D>("RayCast2D");                                                                       //referencia al raycast
        moverConTween   = GetNode <Tween>("Tween");                                                                               //referencia al nodo tween
        targetCharacter = (KinematicBody2D)GetTree().GetNodesInGroup("Player")[0];                                                //referencia al nodo del personaje
        playback        = (AnimationNodeStateMachinePlayback)GetNode <AnimationTree>("AnimationTree").Get("parameters/playback"); //accedo al nodo animation three y a la propiedad de las maquinas de estado
        playback.Start("EnemyIdle");                                                                                              //como inicia la animación del personaje

        //para procesar el audio
        scavengersEnemyNode = (AudioStreamPlayer)GetTree().GetNodesInGroup("scavengers_enemy")[0]; //busco el nodo que controla el audio
        scavengers_enemy.Add((AudioStreamOGGVorbis)GD.Load("res://musica/scavengers_enemy1.ogg")); //agrego el recurso de sonido
        scavengers_enemy.Add((AudioStreamOGGVorbis)GD.Load("res://musica/scavengers_enemy2.ogg")); //agrego el recurso de sonido

        //procesar animaciones de efectos
        AnimationPlayerEfectos = (AnimationPlayer)GetTree().GetNodesInGroup("AnimationPlayerEfectos")[0];
    }
Example #29
0
    Wall hitWall;//referencia a la pared que esta chocando



    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        //OS.CurrentScreen = 1;//para iniciar el juego en otro monitor y poder trabajar con 2 monitores

        movementSpeed = 1f / moveTime;                                                                                         //velocidad a la que se movera
        BoxCollider   = GetNode <CollisionShape2D>("CollisionShape2D");
        rayo          = GetNode <RayCast2D>("RayCast2D");                                                                      //referencia al raycast
        moverConTween = GetNode <Tween>("Tween");                                                                              //referencia al nodo tween
        //rb2D = thi;por ahora voy a evitarla
        animator     = GetNode <AnimationTree>("AnimationTree");                                                               //referencia al animation three
        _GameManager = (GameManager)GetTree().GetNodesInGroup("GameManager")[0];
        playback     = (AnimationNodeStateMachinePlayback)GetNode <AnimationTree>("AnimationTree").Get("parameters/playback"); //accedo al nodo animation three y a la propiedad de las maquinas de estado
        playback.Start("PlayerIdle");                                                                                          //animación inicial player estatico osea igle
        _SingletonVariables = GetNode <SingletonVariables>("/root/SingletonVariables");                                        //para acceder al singleton desde el player y cambiar el número del nivel y guardar el puntaje
        _FoodText           = (Label)GetTree().GetNodesInGroup("FoodText")[0];                                                 //accedo al nodo label que muestra la comida en la pantalla
        food           = _SingletonVariables.food;                                                                             //la comida inicial del jugador busco desde el game manager
        _FoodText.Text = "food " + food;                                                                                       //comida del jugador
        //para procesar el audio y buscar los nodos
        scavengersFootstepNode = (AudioStreamPlayer)GetTree().GetNodesInGroup("scavengers_footstep")[0];
        scavengersFruitNode    = (AudioStreamPlayer)GetTree().GetNodesInGroup("scavengers_fruit")[0];
        scavengersSodaNode     = (AudioStreamPlayer)GetTree().GetNodesInGroup("scavengers_soda")[0];
        scavengersDieNode      = (AudioStreamPlayer)GetTree().GetNodesInGroup("scavengers_die")[0];
        scavengersMusicNode    = (AudioStreamPlayer)GetTree().GetNodesInGroup("MusicGame")[0];
    }
Example #30
0
File: Player.cs Project: itlbv/evo
 public override void _Ready()
 {
     animationPlayer = GetNode <AnimationPlayer>("Animation/AnimationPlayer");
     animationTree   = GetNode <AnimationTree>("Animation/AnimationTree");
     animationState  = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback;
 }