コード例 #1
0
    private PlayerTypes Temp_GetTrialEndPlayerType(Room _room)
    {
        string rk      = _room.RoomKey;
        string typeStr = rk.Substring(0, rk.IndexOf("TrialEnd", System.StringComparison.Ordinal));

        return(PlayerTypeHelper.TypeFromString(typeStr));
    }
コード例 #2
0
    // ----------------------------------------------------------------
    //  Save / Load
    // ----------------------------------------------------------------
    public void LoadFromSaveData()
    {
        string str = SaveStorage.GetString(SaveKeys.PlayerLineup, PlayerTypes.Neutrala.ToString());

        string[] strs = str.Split(',');
        Lineup = new List <PlayerTypes>();
        for (int i = 0; i < strs.Length; i++)
        {
            Lineup.Add(PlayerTypeHelper.TypeFromString(strs[i]));
        }
    }
コード例 #3
0
ファイル: Snack.cs プロジェクト: BATzerk/Unity-BounceMeister
    public void Initialize(Room _myRoom, SnackData data, int myIndex)
    {
        base.InitializeAsProp(_myRoom, data);
        this.myIndex    = myIndex;
        this.playerType = PlayerTypeHelper.TypeFromString(data.playerType);

        // Load wasEverEaten!
        wasEverEaten = SaveStorage.GetBool(SaveKeys.DidEatSnack(MyRoom, myIndex));
        isEaten      = wasEverEaten;

        UpdatePresence();
    }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
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();
    }
コード例 #6
0
    // ----------------------------------------------------------------
    //  Start
    // ----------------------------------------------------------------
    public void Initialize(Room _myRoom, CharBarrelData data, int myIndex)
    {
        base.InitializeAsProp(_myRoom, data);

        timeWhenCanSensePlayer = Time.time;

        this.otherCharName = data.otherCharName;
        this.myIndex       = myIndex;

        // Load what character's in me!
        string savedCharType = SaveStorage.GetString(SaveKeys.CharBarrelTypeInMe(MyRoom.MyRoomData, myIndex), otherCharName);

        SetCharTypeInMe(PlayerTypeHelper.TypeFromString(savedCharType));
    }
コード例 #7
0
 public void Refresh(RoomData rd)
 {
     // Clear totals.
     ZeroCounts();
     // Recalculate totals!
     for (int i = 0; i < rd.snackDatas.Count; i++)
     {
         PlayerTypes playerType = PlayerTypeHelper.TypeFromString(rd.snackDatas[i].playerType);
         total[playerType]++;
         Total_All++;
         //total[PlayerTypes.Every] ++;
         if (SaveStorage.GetBool(SaveKeys.DidEatSnack(rd, i)))
         {
             eaten[playerType]++;
             Eaten_All++;
         }
     }
 }
コード例 #8
0
 // ----------------------------------------------------------------
 //  Initialize
 // ----------------------------------------------------------------
 public RoomClusterData(int WorldIndex, string startRoomKey)
 {
     this.MyAddress = new RoomAddress(WorldIndex, -1);
     // TEMP HARDCODED-ISH set TrialPlayerType!
     if (WorldIndex == GameProperties.TEMP_TrialsWorldIndex)
     {
         string rk     = startRoomKey;
         int    strInd = rk.IndexOf("TrialStart", System.StringComparison.Ordinal);
         if (strInd >= 0)
         {
             string typeStr = rk.Substring(0, strInd);
             TrialPlayerType = PlayerTypeHelper.TypeFromString(typeStr);
         }
         else
         {
             Debug.LogWarning(startRoomKey + " doesn't fit char-trial-start-cluster naming scheme.");
         }
     }
 }
コード例 #9
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++;
                }
            }
        }