Пример #1
0
    // ----------------------------------------------------------------
    //  Doers
    // ----------------------------------------------------------------
    private void SetCharTypeInMe(PlayerTypes _type)
    {
        CharTypeInMe = _type;
        // Color my body!
        Color playerColor = PlayerBody.GetBodyColorNeutral(CharTypeInMe);

        sr_body.color = Color.Lerp(playerColor, Color.black, 0.2f); // darken it slightly.
    }
 private void AddPropSprites()
 {
     foreach (PropData propData in myRD.allPropDatas)
     {
         // -- Batteries --
         if (propData.GetType() == typeof(BatteryData))
         {
             BatteryData pd = propData as BatteryData;
             AddSpriteRenderer("Battery", rh.s_battery, go_props, pd.pos, BatteryIconSize, 10, Color.white);
         }
         // -- Grounds --
         else if (propData.GetType() == typeof(GroundData))
         {
             GroundData pd = propData as GroundData;
             groundDatas.Add(pd);                                                                                  // also add it to my ref list!
             srs_grounds.Add(AddSpriteRenderer("Ground", rh.s_ground, go_props, pd.pos, pd.size, 1, Color.white)); //WHY POSITION? why not center?
         }
         // -- DispGrounds --
         else if (propData.GetType() == typeof(DispGroundData))
         {
             DispGroundData pd    = propData as DispGroundData;
             Color          color = DispGround.GetBodyColor(pd);
             color = new Color(color.r, color.g, color.b, color.a * 0.6f); // alpha it out a bit, to taste.
             AddSpriteRenderer("DispGround", rh.s_ground, go_props, pd.pos, pd.size, 1, color);
         }
         // -- Gems --
         else if (propData.GetType() == typeof(GemData))
         {
             GemData pd     = propData as GemData;
             Sprite  sprite = rh.GetGemSprite(pd.type);
             AddSpriteRenderer("Gem", sprite, go_props, pd.pos, GemIconSize, 10, Color.white);
         }
         // -- Snacks --
         else if (propData.GetType() == typeof(SnackData))
         {
             SnackData pd    = propData as SnackData;
             Color     color = PlayerBody.GetBodyColorNeutral(PlayerTypeHelper.TypeFromString(pd.playerType));
             AddSpriteRenderer("Snack", rh.s_snack, go_props, pd.pos, SnackIconSize, 10, color);
         }
         // -- Spikes --
         else if (propData.GetType() == typeof(SpikesData))
         {
             SpikesData     spikesData = propData as SpikesData;
             Color          color      = Colors.Spikes(myRD.WorldIndex);// new Color(0.7f,0.1f,0f, 0.6f);
             SpriteRenderer newSprite  = AddSpriteRenderer("Spikes", rh.s_spikes, go_props, spikesData.pos, Vector2.one, 0, color);
             newSprite.drawMode = SpriteDrawMode.Tiled;
             newSprite.size     = spikesData.size;
             newSprite.transform.localEulerAngles = new Vector3(0, 0, spikesData.rotation);
         }
     }
 }
Пример #3
0
    // ----------------------------------------------------------------
    //  Start
    // ----------------------------------------------------------------
    public void Initialize(Room _myRoom, CharUnlockOrbData data)
    {
        base.InitializeAsProp(_myRoom, data);

        this.myCharName = data.myCharName;
        MyPlayerType    = PlayerTypeHelper.TypeFromString(myCharName);

        // Color my body!
        Color color = PlayerBody.GetBodyColorNeutral(MyPlayerType);

        sr_body.color = Color.Lerp(color, Color.black, 0.2f); // darken it slightly.

        UpdateUnlockedVisuals();
    }
Пример #4
0
    // ----------------------------------------------------------------
    //  Doers
    // ----------------------------------------------------------------
    private void UpdatePresence()
    {
        Player currPlayer = MyRoom.Player;
        bool   isMyType   = playerType == PlayerTypes.Any ||
                            (currPlayer != null && currPlayer.PlayerType() == playerType);

        // Update my color by my PlayerType.
        Color playerColor = PlayerBody.GetBodyColorNeutral(playerType);

        sr_aura.enabled = !wasEverEaten;
        driftAmp        = 1f; // default these visual values.
        rotScale        = 1f;

        // Matching type!
        if (isMyType)
        {
            sr_body.enabled    = !wasEverEaten;
            myCollider.enabled = !wasEverEaten;
            sr_aura.color      = playerColor;
            sr_body.color      = playerColor;
        }
        // Different type.
        else
        {
            myCollider.enabled = false;
            sr_body.enabled    = !wasEverEaten;
            // I'm unlocked! Color me like the PlayerType.
            if (GameManagers.Instance.DataManager.IsPlayerTypeUnlocked(playerType))
            {
                GameUtils.SetSpriteColor(sr_aura, playerColor, 0.14f);
                GameUtils.SetSpriteColor(sr_body, playerColor, 0.3f);
            }
            // We HAVEN'T unlocked this PlayerType. Make me gray until we do.
            else
            {
                driftAmp      = 0.15f;
                rotScale      = 0.1f;
                sr_aura.color = new Color(0, 0, 0, 0.1f);
                sr_body.color = new Color(0, 0, 0, 0.2f);
            }
        }
    }
Пример #5
0
        private void AddPropImages()
        {
            int snackIndex = 0; // for determining which Snacks we gots!

            foreach (PropData propData in myRD.allPropDatas)
            {
                // -- Spikes --
                if (propData.GetType() == typeof(SpikesData))
                {
                    SpikesData spikesData = propData as SpikesData;
                    Color      color      = Colors.Spikes(myRD.WorldIndex);// new Color(0.7f,0.1f,0f, 0.6f);
                    Image      newObj     = AddImage("Spikes", rh.s_spikes, rt_props, spikesData.pos, spikesData.size, color);
                    newObj.transform.localEulerAngles = new Vector3(0, 0, spikesData.rotation);
                    newObj.type = Image.Type.Tiled;
                    newObj.transform.localScale     = Vector3.one / 100f; // kinda hacky-ish.
                    newObj.rectTransform.sizeDelta *= 100f;
                    newObj.transform.SetAsFirstSibling();                 // put spikes BEHIND everything else.
                }
                // -- Grounds --
                else if (propData.GetType() == typeof(GroundData))
                {
                    GroundData pd    = propData as GroundData;
                    Color      color = new Color255(100, 130, 90).ToColor();//Ground.GetBodyColor(pd, myRD.WorldIndex);
                    AddImage("Ground", rh.s_ground, rt_props, pd.pos, pd.size, color);
                }
                // -- DispGrounds --
                else if (propData.GetType() == typeof(DispGroundData))
                {
                    DispGroundData pd    = propData as DispGroundData;
                    Color          color = DispGround.GetBodyColor(pd);
                    color = new Color(color.r, color.g, color.b, color.a * 0.6f); // alpha it out a bit, to taste.
                    AddImage("DispGround", rh.s_ground, rt_props, pd.pos, pd.size, color);
                }
                // -- Batteries --
                else if (propData.GetType() == typeof(BatteryData))
                {
                    BatteryData pd = propData as BatteryData;
                    AddImage("Battery", rh.s_battery, rt_props, pd.pos, BatteryIconSize, Color.white);
                }
                // -- Gems --
                else if (propData.GetType() == typeof(GemData))
                {
                    GemData pd     = propData as GemData;
                    Sprite  sprite = rh.GetGemSprite(pd.type);
                    AddImage("Gem", sprite, rt_props, pd.pos, GemIconSize, Color.white);
                }
                // -- Snacks --
                else if (propData.GetType() == typeof(SnackData))
                {
                    SnackData pd = propData as SnackData;
                    Color     color;
                    bool      didEatSnack = SaveStorage.GetBool(SaveKeys.DidEatSnack(myRD, snackIndex));
                    if (didEatSnack)
                    {
                        color = new Color(0, 0, 0, 0.2f);
                    }
                    else
                    {
                        color = PlayerBody.GetBodyColorNeutral(PlayerTypeHelper.TypeFromString(pd.playerType));
                    }
                    AddImage("Snack", rh.s_snack, rt_props, pd.pos, SnackIconSize, color);
                    snackIndex++;
                }
            }
        }