Exemplo n.º 1
0
    public override void _Ready()
    {
        string upgrade = PlayerUpgrade.EnumToStringUpgrades(upgradeName);

        if (WorldManager.instance.WorldInfoHas(upgrade))
        {
            if (WorldManager.instance.GetWorldInfoData <bool>(upgrade))
            {
                QueueFree();
                return;
            }
        }
        GetChild <Area>(0).Connect("body_entered", this, nameof(UpgradeCollected));
        GetChild <AnimationPlayer>(2).CurrentAnimation = "Hovering";
    }
Exemplo n.º 2
0
 private void UpgradeCollected(Node body)
 {
     if (body.Name.Equals("Player"))
     {
         string upgrade = PlayerUpgrade.EnumToStringUpgrades(upgradeName);
         if (PlayerController.Instance.upgrades.GetUpgrade(upgrade))
         {
             QueueFree();
             return;
         }
         PlayerController.Instance.upgrades.SetUpgradeTo(upgrade, true);
         WorldManager.instance.AddToWorldInfo(upgrade, true);
         InGameMenu.Instance.GetUpgrade(name, description);
         QueueFree();
     }
 }