Esempio n. 1
0
    public override void _Ready()
    {
        _area           = GetNode("Area2D") as Area2D;
        _tooltip        = GetNode("interact_tooltip") as InteractTooltip;
        _globals        = GetNode("/root/Globals") as Globals;
        _fireplaceLight = GetNode("fireplace_light") as Light2D;

        var characters = GetTree().GetNodesInGroup("main_character");

        if (characters != null)
        {
            _mainCharacter = characters[0] as BasicCharacter;
        }
    }
Esempio n. 2
0
    public void TryInteract(BasicCharacter character)
    {
        if (CanInteract)
        {
            if (TooltipEnabled)
            {
                InteractTooltip tooltip = GetNode(TooltipPath) as InteractTooltip;

                tooltip?.FadeOut();
            }

            CanInteract = false;
            character.PickupObject(this);
        }
    }
Esempio n. 3
0
    public override void _Ready()
    {
        HeatSpeed = 0.0f;

        _area           = GetNode("Area2D") as Area2D;
        _tooltip        = GetNode("interact_tooltip") as InteractTooltip;
        _globals        = GetNode("/root/Globals") as Globals;
        _fireplaceLight = GetNode("fireplace_light") as Light2D;

        _veins           = GetNode("veins") as Sprite;
        _glow            = GetNode("glow") as Sprite;
        _hearth          = GetNode("hearth") as Sprite;
        _animationPlayer = GetNode("AnimationPlayer") as AnimationPlayer;

        var characters = GetTree().GetNodesInGroup("main_character");

        if (characters != null)
        {
            _mainCharacter = characters[0] as BasicCharacter;
        }
    }
Esempio n. 4
0
        protected virtual void Awake()
        {
            MainCam = Camera.main;

            OwnCollider      = GetComponent <Collider>();
            _ownMeshRenderer = GetComponent <MeshRenderer>();
            PlayerController = PlayerManager.Instance.GetPlayerController();

            // if scale should be checked, set _notGatherable
            if (checkScale)
            {
                _notGatherable = transform.localScale.x > maxScale || transform.localScale.y > maxScale ||
                                 transform.localScale.z > maxScale;
                if (_notGatherable)
                {
                    enabled = false;

                    InteractTooltip tooltip = GetComponent <InteractTooltip>();
                    tooltip.isDisabled = true;
                    tooltip.enabled    = false;
                }
            }

            if (destroyAfterHarvest)
            {
                Parent = transform.parent.gameObject;
            }
            else
            {
                _replacementMeshRenderer = replacement.GetComponent <MeshRenderer>();
            }

            // If item was respawning before save, keep it respawning
            if (isRespawning)
            {
                CoroutineManager.Instance.WaitForSeconds(1.0f / 60.0f, () => StartCoroutine(Respawn()));
            }
        }