コード例 #1
0
    private void _on_HurtBox_area_entered(object area)
    {
        GD.Print("Creature GET!");

        Caught = true;

        var playerSub = GlobalManager.GetGlobalGameVariables(this).PlayerSub;

        playerSub.CreatureGet(this, Cost, SpriteName);

        // Replace with function body.
    }
コード例 #2
0
ファイル: GameWorld.cs プロジェクト: lithiastudios/public
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        ScoreSummaryTimer = GetNode <Timer>("ScoreSummaryTimer");
        TimeStarted       = DateTime.Now;
        OS.CenterWindow();
        LastObstacle = DateTime.Now;
        LastCreature = DateTime.Now;

        ScoreCanvas               = GetNode <CanvasLayer>("ScoreCanvas");
        PlayerMoneyLabel          = GetNode <Label>("ScoreCanvas/PlayerMoneyLabel");
        DepthLabel                = GetNode <Label>("ScoreCanvas/DepthLabel");
        GameOverTimer             = GetNode <Timer>("GameOverTimer");
        PlayerSub                 = (PlayerSub)GetNode("PlayerSub");
        CircleWipeAnimationPlayer = (AnimationPlayer)GetNode("CircleWipe/ColorRect/AnimationPlayer");

        var globalVars = GlobalManager.GetGlobalGameVariables(this);

        globalVars.PlayerSub = PlayerSub;

        RandomNumberGenerator = new RandomNumberGenerator();
        RandomNumberGenerator.Randomize();

        LeftWall  = GetNode <Wall>("LeftWall");
        LeftWall2 = GetNode <Wall>("LeftWall2");

        RightWall  = GetNode <Wall>("RightWall");
        RightWall2 = GetNode <Wall>("RightWall2");

        LeftWall.GlobalPosition  = new Vector2(LeftWall.GlobalPosition.x, 0);
        RightWall.GlobalPosition = new Vector2(RightWall.GlobalPosition.x, 0);

        LeftWall2.GlobalPosition  = new Vector2(LeftWall.GlobalPosition.x, LeftWall2.CollisionHeight * 2);
        RightWall2.GlobalPosition = new Vector2(RightWall.GlobalPosition.x, RightWall2.CollisionHeight * 2);

        GameIsStarting = true;
        CircleWipeAnimationPlayer.Play("circle_out");

        SetPlayerMoneyText();
    }