コード例 #1
0
    protected void slowDownBoostTrail()
    {
        Particles2D boosterTrail = (Particles2D)GetNode("Partilcle2DBoosterTrail");

        boosterTrail.SpeedScale = 1;
        boosterTrail.Lifetime   = 1;
    }
コード例 #2
0
        public Particles2D GetParticleSet(string setKey)
        {
            Particles2D res = null;

            switch (setKey)
            {
            case "set1":
                res = particleSet1;
                break;

            case "set2":
                res = particleSet2;
                break;

            case "set3":
                res = particleSet3;
                break;

            case "set4":
                res = particleSet4;
                break;

            default:
                break;
            }
            return(res);
        }
コード例 #3
0
    protected void speedUpBoostTrail()
    {
        Particles2D boosterTrail = (Particles2D)GetNode("Partilcle2DBoosterTrail");

        boosterTrail.SpeedScale = 10;
        boosterTrail.Lifetime   = 3;
    }
コード例 #4
0
    public int direcaoInimigo = 0;           //Direção inimigo

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        //Inicializar Nodes
        MyAnimationPlayer = GetNode("AnimationPlayer") as AnimationPlayer;
        MyAreaInimigo     = GetNode("areaInimigo") as Area2D;
        MyBocaInimigo     = GetNode("bocaInimigo") as Area2D;
        MyDestroyTimer    = GetNode("destroy_timer") as Timer;
        MySprite          = GetNode("Sprite") as Sprite;
        MyTween           = GetNode("Tween") as Tween;
        MyParticles2D     = GetNode("Particles2D") as Particles2D;
        MyExplodir        = GetNode("explodir") as AudioStreamPlayer2D;

        //Conectar o AnimationPlayer quando terminar a animação
        MyAnimationPlayer.Connect("animation_finished", this, "AnimacaoTerminada");

        //Conectar ao entrar na area do personagem
        MyAreaInimigo.Connect("body_entered", this, "EntrouAreaPersonagem");

        //Conectar ao sair da area do personagem
        MyAreaInimigo.Connect("body_exited", this, "SaiuAreaPersonagem");

        //Conectar o fim do tempo de destruir
        MyDestroyTimer.Connect("timeout", this, "Destruir");

        //Iniciar animação do inimigo
        MyAnimationPlayer.Play("paradoEsquerda");
    }
コード例 #5
0
ファイル: SlasherEnemy.cs プロジェクト: Rud156/StormTime
        public override void _Ready()
        {
            base._Ready();

            _slasherEffect         = GetNode <Particles2D>(slasherEffectNode);
            _slasherEnemyCollision = GetNode <SlasherEnemyCollision>(slasherEnemyCollisionNodePath);
        }
コード例 #6
0
 public PSCharge(Player player, float chargeRate = 10)
     : base(player)
 {
     this.player      = player;
     this.charge_rate = chargeRate;
     poseParticles    = player.GetNode <Particles2D>("PoseParticles");
 }
コード例 #7
0
ファイル: Personagem.cs プロジェクト: walney/youtubeGodot
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        //Inicializar Nodes
        MyAreaDano        = GetNode("areaDano") as Area2D;
        MyAreaBater       = GetNode("areaBater") as Area2D;
        MyTempoMorrer     = GetNode("tempoMorrer") as Timer;
        MyTempoInvencivel = GetNode("tempo_invencivel") as Timer;
        MyAnimationPlayer = GetNode("AnimationPlayer") as AnimationPlayer;
        MyCamera2D        = GetNode("Camera2D") as Camera2D;
        MySprite          = GetNode("Sprite") as Sprite;
        MyParticles2D     = GetNode("Particles2D") as Particles2D;
        MyTween           = GetNode("Tween") as Tween;
        MyPulo            = GetNode("pulo") as AudioStreamPlayer2D;
        MyDano            = GetNode("dano") as AudioStreamPlayer2D;

        //Conectar a Area2D que vai detectar se o Personagem colidiu com o Inimigo
        MyAreaDano.Connect("area_entered", this, "OnAreaDanoAreaEntered");

        //Conectar areaBater entrar
        MyAreaBater.Connect("area_entered", this, "OnAreaBaterAreaEntered");

        //Conectar areaBater Sair
        MyAreaBater.Connect("area_exited", this, "OnAreaBaterAreaExited");

        //Conectar timer
        MyTempoMorrer.Connect("timeout", this, "TempoMorrer");

        //Iniciar animação
        MyAnimationPlayer.Play("parado");

        //Camera Offset
        MyCamera2D.Offset = new Vector2(MyCamera2D.Offset.x, cameraOffSet);
    }
コード例 #8
0
 public override void _Ready()
 {
     bushSprite    = GetNode <Sprite>("BushSprite");
     bushShape     = GetNode <CollisionShape2D>("BushBody/BushBodyShape");
     deathTimer    = GetNode <Timer>("DeathTimer");
     leafParticles = GetNode <Particles2D>("LeafParticles");
 }
コード例 #9
0
 public override void _Ready()
 {
     this.PortalOpening      = this.GetNode <Particles2D>("PortalOpening");
     this.AnimationPlayer    = this.GetNode <AnimationPlayer>("AnimationPlayer");
     this.DodgeDetector      = this.GetNode <DodgeDetector>("DodgeDetector");
     this.WaitTimer          = this.GetNode <Timer>("WaitTimer");
     this.WaitTimer.WaitTime = WaitingTime;
 }
コード例 #10
0
 public override void _Ready()
 {
     base._Ready();
     _body             = (Sprite)GetNode("Sprite");
     _effect           = (Sprite)GetNode("Effect");
     DamageEffectTimer = (Timer)GetNode("DamageEffectTimer");
     _smoke            = (Particles2D)GetNode("Smoke");
 }
コード例 #11
0
ファイル: Laser.cs プロジェクト: IndieRonin/AutoPrep
 public override void _Ready()
 {
     SetAsToplevel(true);
     laserBeam        = GetNode <Line2D>("LaserBeam");
     BeamHitParticles = GetNode <Particles2D>("BeamHitParticles");
     hitBox           = GetNode <KinematicBody2D>("../../../LaserTurret");
     parentNode       = ((Node2D)GetParent());
 }
コード例 #12
0
 public void Event_SoulParts1Appear()
 {
     Controller.PlaySoundBurst(soulStealSound3);
     Controller.PlaySoundBurst(soulStealSound4, pitch: 0.6f);
     parts1          = (Particles2D)soulParts1.Instance();
     parts1.Position = new Vector2(Player.Main.Position.x, Player.Main.Position.y + 36);
     GetTree().GetRoot().AddChild(parts1);
 }
コード例 #13
0
 public override void _Ready()
 {
     _gameManager     = GetNodeOrNull <GameManager>("../../GameManager");
     _controllable    = GetNode <Controllable>("..");
     _damageIndicator = GetNode <Particles2D>("DamageIndicator");
     _h1 = GetNode <AnimatedSprite>("../Heart");
     _h2 = GetNode <AnimatedSprite>("../Heart2");
 }
コード例 #14
0
 public void Event_NeftaliFace2()
 {
     face2 = (Sprite)neftaliFace1.Instance();
     face2.GetNode <AnimationPlayer>("AnimationPlayer").Play("Fade 1");
     face2.Position = new Vector2(Player.Main.Position.x + 200, Player.Main.Position.y - 80);
     GetTree().GetRoot().AddChild(face2);
     parts3 = (Particles2D)partsEnd.Instance();
     Player.Main.AddChild(parts3);
 }
コード例 #15
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        particles         = GetNode <Particles2D>("Particles2D");
        particlesMaterial = particles.ProcessMaterial as ParticlesMaterial;

        noise             = new OpenSimplexNoise();
        noise.Octaves     = 4;
        noise.Period      = 20f;
        noise.Persistence = 0.8f;
    }
コード例 #16
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     mapClusterParticleTextures = new Dictionary <string, ImageTexture>();
     mapActiveSets             = new Dictionary <string, bool>();
     mapParticleImageResources = new Dictionary <string, string>();
     LoadPresetResources();
     particleSet1 = GetNodeOrNull <Particles2D>("Particles2D-1");
     particleSet2 = GetNodeOrNull <Particles2D>("Particles2D-2");
     particleSet3 = GetNodeOrNull <Particles2D>("Particles2D-3");
     particleSet4 = GetNodeOrNull <Particles2D>("Particles2D-4");
 }
コード例 #17
0
    public override void _Ready()
    {
        _alchemy        = GetParent().GetParent <Alchemy>();
        _mortarSplash   = GetParent().GetNode <Particles2D>("Crush/MortarSplash");
        _pestle         = GetParent().GetNode <Pestle>("Pestle");
        _potionCircle   = GetParent().GetNode <PotionCircle>("Crush/PotionCircle");
        _potionProgress = GetParent().GetNode <TextureProgress>("Crush/PotionProgress");

        _mortarSplashBurst = GD.Load <PackedScene>("res://particle/MortarSplashBurst.tscn");

        _pestle.Connect("body_entered", this, nameof(_OnPestleBodyEntered));
    }
コード例 #18
0
ファイル: Raygun.cs プロジェクト: Epita13/Ollopa_main
 public override void _Ready()
 {
     anSprite       = GetNode <Sprite>("Sprite_Raygun");
     raycast        = anSprite.GetNode <RayCast2D>("shoot_ray");
     beam           = GetNode <Sprite>("beam");
     begin          = GetNode <Sprite>("begin");
     end            = GetNode <Position2D>("end");
     particule      = end.GetNode <Particles2D>("explosion");
     raycast.CastTo = new Vector2(RADIUS, raycast.CastTo.y);
     begin.Visible  = false;
     beam.Visible   = false;
 }
コード例 #19
0
    public void ActionButtonPressed(Vector2 position)
    {
        // Casts a ray 1 tile in front of the player

        var     spaceState = GetWorld2d().DirectSpaceState;
        Vector2 rayFrom    = Position;

        rayFrom.y += 8f;
        var result = spaceState.IntersectRay(rayFrom, rayFrom + (DirectionAsVector() * 16f), new Godot.Collections.Array(new object[] { this }), collideWithAreas: true);

        if (result.Count > 0)
        {
            // Has collided

            IInteractable interactable = null;

            if ((result["collider"]) is CollisionObject2D col && col.GetParent() is IInteractable interactableCol)
            {
                interactable = interactableCol;
            }
            else if ((result["collider"]) is IInteractable interactableObj)
            {
                interactable = interactableObj;
            }

            if (interactable != null)
            {
                if (interactable is WavyGrass || interactable is ShakePlant)
                {
                    PlayFootstep(Gathering.Terrain.Grass);
                }

                if (interactable.HasInteractParticle())
                {
                    Particles2D newParticle = interactable.GetInteractParticles();
                    newParticle.Position = ((Node2D)interactable).Position + new Vector2(8, -8);
                    GetParent().AddChild(newParticle);
                    _interactParticles.Add(newParticle);
                    GetTree().CreateTimer(2.0f).Connect("timeout", this, nameof(PopInteractParticle));
                }

                if (interactable.Interact(this))
                {
                    // Play sound
                    _miscPlayer.Stream = _magicPopSounds[GD.Randi() % 5];
                    _miscPlayer.Play();

                    ((Node2D)interactable).QueueFree();
                }
            }
        }
コード例 #20
0
    public override void _Ready()
    {
        _globals          = GetNode("/root/Globals") as Globals;
        _carryAttachPoint = GetNode("carry_attach_point") as Node2D;
        _healthParticles  = GetNode("health_particles") as Particles2D;
        _animationPlayer  = GetNode("AnimationPlayer") as AnimationPlayer;

        _footprintPlayers = new List <AudioStreamPlayer>();
        _footprintPlayers.Add(GetNode("footprint_sound_1") as AudioStreamPlayer);
        _footprintPlayers.Add(GetNode("footprint_sound_2") as AudioStreamPlayer);
        _animationPlayer.Stop();

        _random = new Random();
    }