Ejemplo n.º 1
0
        public MapObjectBase(Color foreground, Color background, int character)
        {
            Appearance = new CellAppearance(foreground, background, character);
            Info       = new TileInfo();

            Info.IsInFOV    = false;
            Info.IsExplored = false;

            Info.Description = "MapbjectBase";

            EffectExplored = new Recolor()
            {
                Foreground   = Color.LightGray * 0.4f,
                Background   = Color.LightGray * 0.1f,
                DoForeground = true,
                DoBackground = true,
                CloneOnApply = false
            };

            EffectHidden = new Recolor()
            {
                Foreground   = Color.Black,
                Background   = Color.Black,
                DoForeground = true,
                DoBackground = true,
                CloneOnApply = false
            };
        }
Ejemplo n.º 2
0
    void FieldOfViewOnTargetsVisibilityChange(List <Transform> newTargets)
    {
        if (!ChunkManager.staticFogEnabled)
        {
            return;
        }
        if (Recolor.IsIgnored(gameObject.GetComponent <GameEntity>()) &&
            FieldOfView.visibleBefore.Contains(transform))
        {
            renderer.enabled  = true;
            entScript.enabled = true;
        }
        else
        {
            var cont = newTargets.Contains(transform);
            renderer.enabled = cont;

            //Block script logic only on neutral ents
            if (!cont && !GroupUtil.IsNeutral(entScript.Group))
            {
                cont = true;
            }
            entScript.enabled = cont;
        }
    }
Ejemplo n.º 3
0
        public MapConsole(int width, int height) : base(width, height)
        {
            // Create the map
            IMapCreationStrategy <Map> mapCreationStrategy = new RandomRoomsMapCreationStrategy <Map>(width, height, 100, 15, 4);

            map = Map.Create(mapCreationStrategy);

            mapData = new SadConsole.CellAppearance[width, height];



            foreach (var cell in map.GetAllCells())
            {
                if (cell.IsWalkable)
                {
                    // Our local information about each map square
                    mapData[cell.X, cell.Y] = new MapObjects.Floor();
                    // Copy the appearance we've defined for Floor or Wall or whatever, to the actual console data that is rendered
                    mapData[cell.X, cell.Y].CopyAppearanceTo(this[cell.X, cell.Y]);
                }
                else
                {
                    mapData[cell.X, cell.Y] = new MapObjects.Wall();
                    mapData[cell.X, cell.Y].CopyAppearanceTo(this[cell.X, cell.Y]);
                }
            }

            // Create map effects
            explored            = new SadConsole.Effects.Recolor();
            explored.Background = Color.White * 0.3f;
            explored.Foreground = Color.White * 0.3f;
            explored.Update(10d);             // Trickery to force the fade to complete to the destination color.

            // Entities
            entities = new List <SadConsole.Game.GameObject>();

            // Create the player
            player = new Entities.Player();
            var tempCell = GetRandomEmptyCell();

            player.Position     = new Microsoft.Xna.Framework.Point(tempCell.X, tempCell.Y);
            player.RenderOffset = this.Position;
            entities.Add(player);

            // Create a hound
            GenerateHound();
            GenerateHound();
            GenerateHound();

            // Initial view
            UpdatePlayerView();

            // Keyboard setup
            SadConsole.Engine.Keyboard.RepeatDelay        = 0.07f;
            SadConsole.Engine.Keyboard.InitialRepeatDelay = 0.1f;
        }
Ejemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        recolor = PostProcessManager.I.Recolor;

        _isEnabled.onValueChanged.AddListener(SetRecolor);
        _changeGradient.onClick.AddListener(SetNewGradient);
        gradTexture       = new Texture2D(160, 1);
        _gradient.texture = gradTexture;
        gradient          = new Color[160];
    }
Ejemplo n.º 5
0
 public override void ColorizeOverwrite(Recolor r)
 {
     SetMaterial(r.material);
     if (r.sprites != null)
     {
         for (int ii = 0; ii < r.sprites.Length; ++ii)
         {
             realizedFrames[ii].s = r.sprites[ii].s;
         }
     }
     SetFrame(currFrame);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Call this before SetHotCold, as this resets the frame timings.
 /// </summary>
 /// <param name="r"></param>
 protected override void Colorize(Recolor r)
 {
     SetMaterial(r.material);
     if (r.sprites != null)
     {
         for (int ii = 0; ii < r.sprites.Length; ++ii)
         {
             realizedFrames[ii] = r.sprites[ii];
         }
     }
     SetFrame(currFrame);
 }
Ejemplo n.º 7
0
        public MapObjectBase(Color foreground, Color background, int character)
        {
            Appearance = new CellAppearance(foreground, background, character);
            EffectSeen = new Recolor()
            {
                Foreground   = Color.LightGray * 0.3f,
                Background   = Color.LightGray * 0.3f,
                DoForeground = true,
                DoBackground = true,
                CloneOnApply = false
            };

            EffectHidden = new Recolor()
            {
                Foreground   = Color.Black,
                Background   = Color.Black,
                DoForeground = true,
                DoBackground = true,
                CloneOnApply = false
            };
        }
Ejemplo n.º 8
0
 public static void UpdateFog()
 {
     //var field = ent.transform.GetComponentsInChildren<FieldOfView>();
     FindAllVisibleTargets();
     Recolor.OnFogChange();
 }
Ejemplo n.º 9
0
        public static void RecolorObject(GameEntity ent, bool trueCall)
        {
            if (ent == null || ((Recolor.IsHided(ent) && !trueCall) && ChunkManager.staticFogEnabled))
            {
                return;
            }


            var mod   = 3f;
            var upper = ChunkUtil.GetUpper(ent.CurrentPos);

            if ((ChunkUtil.IsAnyEntity(ent.ChunkNumber, upper) ||
                 !SecondaryGroundLvL.IsEmptyPos(ent.ChunkNumber, upper)) &&
                ent.CurrentPos.z + 1 != ChunkManager.MaxGroundsLvls)
            {
                mod += 2.5f;
            }


            var i     = 1f / ((ent.CurrentPos.z + mod) * 0.3f);
            var color = new Color(i, i, i);

            if (ChunkUtil.IsEntity(ent.ChunkNumber, upper) &&
                ent.CurrentPos.z + 1 != ChunkManager.MaxGroundsLvls)
            {
                var chunk    = ChunkManager.GetChunkByNum(ent.ChunkNumber);
                var upperEnt = chunk.GetGameObjectByIndex(upper);
                if (upperEnt != null)
                {
                    if (TreeGroup.IsTreeGroup(upperEnt.Group))
                    {
                        color.r = 0.5f;
                        color.b = 0.7f;
                        color.g = 0.3f;
                    }
                    else if (upperEnt.Group == "rock")
                    {
                        color.r = 0.3f;
                        color.b = 0.7f;
                        color.g = 0.2f;
                    }
                    else if (upperEnt is GameUnit)
                    {
                        var unit = upperEnt as GameUnit;
                        if (unit.IsEnemy(PlayersManager.GetMyPlayer()))
                        {
                            color.r = 1;
                            color.b = 0.3f;
                            color.g = 0.3f;
                        }
                        else
                        {
                            color.r = 0.1f;
                            color.b = 0.1f;
                            color.g = 0.6f;
                        }
                    }
                    else
                    {
                        color.r = 0.1f;
                        color.b = 0.1f;
                        color.g = 0.6f;
                    }
                }
            }

            if (!GroupUtil.isCreatureGroup(ent.Group) &&
                !GroupUtil.isBuilding(ent.Group))
            {
                var spriteRenderer = ent.GetComponent <SpriteRenderer>();
                spriteRenderer.color = color;
            }
        }
Ejemplo n.º 10
0
 public RecolorBuildStep(ImageCasterConfig config)
 {
     this.Config = config.Build.Recolor.RequireNonNull();
 }