コード例 #1
0
ファイル: Creature.cs プロジェクト: carlesvallve/Tiler
    // =====================================================
    // Visibility
    // =====================================================

    public override void SetVisibility(Tile tile, bool visible, float shadowValue)
    {
        // creature is being seen by the player right now
        this.visible = visible;
        container.gameObject.SetActive(visible);

        // apply shadow
        SetShadow(visible ? shadowValue : 1);
        if (!visible && tile.explored)
        {
            SetShadow(0.6f);
        }

        // apply hpBar shadow
        bar.SetShadow(visible ? shadowValue : 1);
        if (!visible && tile.explored)
        {
            bar.SetShadow(0.6f);
        }

        // once we have seen the tile, mark the tile as explored
        if (visible)
        {
            tile.explored = true;
        }
    }