예제 #1
0
 public void UpdateRoomConfig(List <SamTags> tags, Fear fearType, float fearIntensity)
 {
     samLineManager.CleanPipe();
     if (states.GetGameState() != GameStates.PLAY_MODE)
     {
         states.SetGameState(GameStates.PLAY_MODE);
     }
     ++incIntroductionRoom;
     currentRoom = new Room(fearType.ToString(), fearIntensity, fearType, tags, Time.time);
     Debug.Log("wuuuut");
     if (currentRoom.GetSamTags().Count > 0)
     {
         Debug.Log("Room Name :: " + currentRoom.GetRoomName() + ", tags :: " + currentRoom.GetSamTags()[0].name);
     }
     else
     {
         Debug.Log("Room Name :: " + currentRoom.GetRoomName());
     }
     if (incIntroductionRoom == 1)
     {
         states.SetGameState(GameStates.INTRODUCTION);
         samLineManager.CleanPipe();
         ConfigureSoundFirstRoom();
     }
     else if (incIntroductionRoom == 2)
     {
         states.SetGameState(GameStates.INTRODUCTION);
         samLineManager.CleanPipe();
         ConfigureSoundSecondRoom();
     }
     else if (currentRoom.FindSamTagsByName("Jumps") != null)
     {
         samLineManager.CleanPipe();
         ConfigureSoundVertigoRoom();
     }
     else if (currentRoom.FindSamTagsByName("moving_room") != null && currentRoom.FindSamTagsByName("moving_room").name == "moving_room")
     {
         samLineManager.CleanPipe();
         ConfigureSoundClaustrophobiaRoom();
     }
     else if (currentRoom.FindSamTagsByName("spider") != null && currentRoom.FindSamTagsByName("spider").name == "spider")
     {
         samLineManager.CleanPipe();
         ConfigureSoundArachnophobiaRoom();
     }
     else if (currentRoom.FindSamTagsByName("Interupt") != null)
     {
         samLineManager.CleanPipe();
         ConfigureSoundNyctophobiaRoom();
     }
 }
예제 #2
0
    public void AddXP(int xp, Powers.POWERTYPE powertype)
    {
        Debug.Log("AddXP : " + LevelUpReached.ToString());
        if (Faith + Fear > XP_Limit)
        {
            return;
        }

        Debug.Log("Adding XP + " + xp + powertype.ToString());

        switch (powertype)
        {
        case Powers.POWERTYPE.GOOD:
            if (Faith + Fear + xp > XP_Limit)
            {
                int faith_pool = Faith + Fear + xp - XP_Limit;
                Faith       = Faith + xp - faith_pool;
                Faith_pool += faith_pool;
                Faith_ratio = Faith / (float)XP_Limit;
                faith_time += Inc_Time * (1 - faith_pool / (float)xp);
            }
            else
            {
                Faith      += xp;
                Faith_ratio = Faith / (float)XP_Limit;
                faith_time += Inc_Time;
            }
            faith_updated = true;
            break;

        case Powers.POWERTYPE.EVIL:
            if (Faith + Fear + xp > XP_Limit)
            {
                int fear_pool = Faith + Fear + xp - XP_Limit;
                Fear       = Fear + xp - fear_pool;
                Fear_pool += fear_pool;
                Fear_ratio = Fear / (float)XP_Limit;
                fear_time += Inc_Time * (1 - fear_pool / (float)xp);
            }
            else
            {
                Fear      += xp;
                Fear_ratio = Fear / (float)XP_Limit;
                fear_time += Inc_Time;
            }
            fear_updated = true;
            break;

        case Powers.POWERTYPE.NEUTRAL:
            if (Faith + Fear + xp > XP_Limit)
            {
                Debug.Log("Here");
                int pool = (Faith + Fear + xp - XP_Limit) / 2;
                Faith_pool += pool;
                Fear_pool  += pool;

                int   unpool      = xp - 2 * pool;
                float faith_share = (Faith + Fear == 0 ? 0.5f : Faith / (float)(Faith + Fear));
                Faith = Faith + Mathf.CeilToInt(unpool * faith_share);
                Fear  = Fear + Mathf.CeilToInt(unpool * (1 - faith_share));

                Faith_ratio = Faith / (float)XP_Limit;
                Fear_ratio  = Fear / (float)XP_Limit;

                float time = (float)(0.5 * Inc_Time * unpool / (float)xp);
                faith_time += time;
                fear_time  += time;
            }
            else
            {
                float faith_share = (Faith + Fear == 0 ? 0.5f : Faith / (float)(Faith + Fear));
                Faith = Faith + Mathf.CeilToInt(xp * faith_share);
                Fear  = Fear + xp - Mathf.CeilToInt(xp * faith_share);
                Debug.Log("fs=" + faith_share.ToString() + ", fa=" + Mathf.CeilToInt(xp * faith_share).ToString() + ", fe=" + Mathf.FloorToInt(xp * (1 - faith_share)).ToString());

                Faith_ratio = Faith / (float)XP_Limit;
                Fear_ratio  = Fear / (float)XP_Limit;

                faith_time += Inc_Time / 2.0f;
                fear_time  += Inc_Time / 2.0f;
            }
            faith_updated = true;
            fear_updated  = true;

            Debug.Log(Faith.ToString() + " + " + Fear.ToString() + " = " + XP_Limit.ToString());
            break;
        }
    }