Exemplo n.º 1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.tag == "Player")
     {
         SaveInformation.Save();
         Debug.Log("You Just Hit a Checkpoint");
         DestroyObject(transform.gameObject);
     }
 }
 public static void Save()
 {
     if (saveInformation = !null)
     {
         saveInformation.Save(savePathFile);
         Debug.Log("Saved");
     }
     else
     {
         Debug.Log("No saveinformation yet");
     }
 }
Exemplo n.º 3
0
 void Start()
 {
     itemData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/StreamingAssets/Items.json"));
     ConstructItemDatabase();
     information.Save();
 }
Exemplo n.º 4
0
    void OnGUI()
    {
//			GUI.skin = PlayerUI;
//		GUI.Box (new Rect (Screen.width - 100,Screen.height - 50,100,50),"Body Count : " + GameInformation.BodyCount.ToString());


        // Variables
        bool IsDestruction_Magic  = false;
        bool IsDebuff_Magic       = false;
        bool IsSupport_Magic      = false;
        bool IsDefensive_Magic    = false;
        bool IsMelee_Offence      = false;
        bool IsMelee_Defence      = false;
        bool IsSurvival_Instincts = false;
        bool IsRanged_Offence     = false;
        bool IsRanged_Support     = false;
        bool IsExpertiseMenu      = true;

        //		//GuiFunctions inside the Expertise Menu
        GUILayout.BeginHorizontal("Box");
        GUILayout.BeginVertical( );

        GUILayout.Label("Max Expertise Points : " + GameInformation.Max_Expertise_Points.ToString());


        //Magic
        GUILayout.BeginHorizontal();
        GUILayout.Label("Destructive Magic : " + GameInformation.Magic_Offense.ToString());
        if (GUILayout.Button("+"))
        {
            if (!IsDestruction_Magic)
            {
                IsDestruction_Magic = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();

        GUILayout.Label("Debuff Magic : " + GameInformation.Magic_Debuff.ToString());

        if (GUILayout.Button("+"))
        {
            if (!IsDebuff_Magic)
            {
                IsDebuff_Magic = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("Defensive Magic : " + GameInformation.Magic_Deffence.ToString());
        if (GUILayout.Button("+"))
        {
            if (!IsDefensive_Magic)
            {
                IsDefensive_Magic = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("Support Magic : " + GameInformation.Magic_Support.ToString());

        if (GUILayout.Button("+"))
        {
            if (!IsSupport_Magic)
            {
                IsSupport_Magic = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();


        //Melee

        GUILayout.Label("Melee Tacttics : " + GameInformation.Melee_Offence.ToString());
        if (GUILayout.Button("+"))
        {
            if (!IsMelee_Offence)
            {
                IsMelee_Offence = true;
            }
            else
            {
                IsMelee_Offence = false;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("Defensive Techniques : " + GameInformation.Melee_Defence.ToString());
        if (GUILayout.Button("+"))
        {
            if (!IsMelee_Defence)
            {
                IsMelee_Defence = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        //Ranged
        GUILayout.Label("Ranged Techniques : " + GameInformation.Ranged_Offence.ToString());

        if (GUILayout.Button("+"))
        {
            if (!IsRanged_Offence)
            {
                IsRanged_Offence = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label("Ranged Support : " + GameInformation.Ranged_Support.ToString());
        if (GUILayout.Button("+"))
        {
            if (!IsRanged_Support)
            {
                IsRanged_Support = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();

        if (IsMelee_Offence)
        {
            GUILayout.BeginHorizontal( );
            GUILayout.Label("1st Strike ");
            if (GameInformation.Melee_Offence == 200)
            {
                GUILayout.Button("/");
            }
            else
            {
                GUILayout.Button("X");
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndHorizontal();



        if (GUI.Button(new Rect(225, 175, Screen.width / 8, 20), "IncreaseLevel"))
        {
            AddExperience.AddExp();
        }

        if (GUI.Button(new Rect(225, 205, Screen.width / 8, 20), "Additem A"))
        {
            I_A_ID = Random.Range(0, ADB.Count);
            ISArmor    isa = ADB.Get(I_A_ID);
            GameObject A   = new GameObject();
            A.name = isa.Name;
            Armor myArmor = A.AddComponent <Armor>();
            myArmor.Name           = isa.Name;
            myArmor.ItemID         = I_A_ID;
            myArmor.Burden         = isa.ISBurden;
            myArmor.Equipment_Slot = isa.EquipmentSlot;
            myArmor.Min_Armor_Rate = (int)isa.Armor.x;
            myArmor.Max_Armor_Rate = (int)isa.Armor.y;
            myArmor.Durability     = isa.Durability;
            myArmor.Max_Durability = isa.MaxDurability;
            myArmor.Value          = isa.ISValue;
            GameInformation.InventoryArmors.Add(myArmor);
            inv_t++;
        }

        if (GUI.Button(new Rect(225, 225, Screen.width / 8, 20), "Additem W"))
        {
            I_W_ID = Random.Range(0, WDB.Count);
            ISWeapon isw      = WDB.Get(I_W_ID);
            Weapon   myweapon = new Weapon();
            myweapon.ItemID            = I_W_ID;
            myweapon.Name              = isw.Name;
            myweapon.Burden            = isw.ISBurden;
            myweapon.Equipment_Slot    = isw.EquipmentSlot;
            myweapon.Min_Damage        = isw.MinDamage;
            myweapon.Durability        = isw.Durability;
            myweapon.Max_Durability    = isw.MaxDurability;
            myweapon.Value             = isw.ISValue;
            myweapon.Equipment_Element = isw.EQElement;
            myweapon.Equipment_Type    = isw.EquipmentType;
            myweapon.Equipment_Range   = isw.EquipmentRange;
            GameInformation.InventoryWeapons.Add(myweapon);
            inv_t++;
        }
        if (GUI.Button(new Rect(225, 245, Screen.width / 8, 20), "Additem P"))
        {
            I_P_ID = Random.Range(0, PDB.Count);
            ISPotion isp      = PDB.Get(I_P_ID);
            Potion   myPotion = new Potion();
            myPotion.Item_ID   = I_P_ID;
            myPotion.Value     = isp.ISValue;
            myPotion.Cool_Down = isp.CoolDownTime;
            myPotion.Max_Stack = isp.MaxStack;
            myPotion.Name      = isp.Name;
            GameInformation.InventoryPotions.Add(myPotion);
            inv_t++;
        }
        GUILayout.BeginHorizontal();
        GUILayout.Space(150);
        GUILayout.Label("Inv");
        GUILayout.EndHorizontal();

        //PlayerStats
        GUILayout.BeginVertical("Box");
        if (GameInformation.Stat_Points > 0)
        {
            GUILayout.Label("Player Name : " + GameInformation.PlayerName);
            GUILayout.Label("Player Level : " + GameInformation.PlayerLevel.ToString());
            GUILayout.Label("Stat Points : " + GameInformation.Stat_Points.ToString());
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Vitality : " + GameInformation.Vitality);

            if (GUILayout.Button("-"))
            {
                GameInformation.Vitality--;
                GameInformation.Stat_Points++;
                if (GameInformation.Vitality < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Vitality++;
//							PlayerUIManager.StatAdjustment ();
                }
            }
            if (GUILayout.Button("+"))
            {
                GameInformation.Vitality++;
                GameInformation.Stat_Points--;
//						PlayerUIManager.StatAdjustment ();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Endurance : " + GameInformation.Endurance);

            if (GUILayout.Button("-"))
            {
                GameInformation.Endurance--;
                GameInformation.Stat_Points++;
                if (GameInformation.Endurance < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Endurance++;
//							PlayerUIManager.StatAdjustment ();
                }
            }
            if (GUILayout.Button("+"))
            {
                GameInformation.Endurance++;
                GameInformation.Stat_Points--;
//						PlayerUIManager.StatAdjustment ();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Dexetry : " + GameInformation.Dexetry);

            if (GUILayout.Button("-"))
            {
                GameInformation.Dexetry--;
                GameInformation.Stat_Points++;
                if (GameInformation.Dexetry < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Dexetry++;
                }
            }
            if (GUILayout.Button("+"))
            {
                GameInformation.Dexetry++;
                GameInformation.Stat_Points--;
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Intellect : " + GameInformation.Intellect);

            if (GUILayout.Button("-"))
            {
                GameInformation.Intellect--;
                GameInformation.Stat_Points++;
                if (GameInformation.Intellect < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Intellect++;
//							PlayerUIManager.StatAdjustment ();
                }
            }
            if (GUILayout.Button("+"))
            {
                GameInformation.Intellect++;
                GameInformation.Stat_Points--;
//						PlayerUIManager.StatAdjustment ();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Strenght : " + GameInformation.Strength);

            if (GUILayout.Button("-"))
            {
                GameInformation.Strength--;
                GameInformation.Stat_Points++;
                if (GameInformation.Strength < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Strength++;
                }
            }
            if (GUILayout.Button("+"))
            {
                GameInformation.Strength++;
                GameInformation.Stat_Points--;
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Aim : " + GameInformation.Aim);

            if (GUILayout.Button("-"))
            {
                GameInformation.Aim--;
                GameInformation.Stat_Points++;
                if (GameInformation.Aim < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Aim++;
                }
            }
            if (GUILayout.Button("+"))
            {
                GameInformation.Aim++;
                GameInformation.Stat_Points--;
            }
            GUILayout.EndHorizontal();
            GUILayout.Label("Money : " + GameInformation.Currency.ToString());
            GUILayout.Label("RequiredXp : " + GameInformation.RequiredXP.ToString());
            GUILayout.Label("Current Xp : " + GameInformation.CurrentXp.ToString());
            GUILayout.EndVertical();
        }


        //Statpoints Controls if stat points reach zero
        if (GameInformation.Stat_Points == 0)
        {
            GUILayout.Label("Player Name : " + GameInformation.PlayerName);
            GUILayout.Label("Player Level : " + GameInformation.PlayerLevel.ToString());
            GUILayout.Label("Stat Points : " + GameInformation.Stat_Points.ToString());
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Vitality : " + GameInformation.Vitality);

            if (GUILayout.Button("-"))
            {
                GameInformation.Vitality--;
                GameInformation.Stat_Points++;
                if (GameInformation.Vitality < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Vitality++;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Endurance : " + GameInformation.Endurance);

            if (GUILayout.Button("-"))
            {
                GameInformation.Endurance--;
                GameInformation.Stat_Points++;

                if (GameInformation.Endurance < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Endurance++;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Dexetry : " + GameInformation.Dexetry);

            if (GUILayout.Button("-"))
            {
                GameInformation.Dexetry--;
                GameInformation.Stat_Points++;
                if (GameInformation.Dexetry < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Dexetry++;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Intellect : " + GameInformation.Intellect);

            if (GUILayout.Button("-"))
            {
                GameInformation.Intellect--;
                GameInformation.Stat_Points++;
                if (GameInformation.Intellect < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Intellect++;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Strength : " + GameInformation.Strength);

            if (GUILayout.Button("-"))
            {
                GameInformation.Strength--;
                GameInformation.Stat_Points++;
                if (GameInformation.Strength < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Strength++;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal( );
            GUILayout.Label("Aim : " + GameInformation.Aim);

            if (GUILayout.Button("-"))
            {
                GameInformation.Aim--;
                GameInformation.Stat_Points++;
                if (GameInformation.Aim < 0)
                {
                    GameInformation.Stat_Points--;
                    GameInformation.Aim++;
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Label("Money : " + GameInformation.Currency.ToString());
            GUILayout.Label("RequiredXp : " + GameInformation.RequiredXP.ToString());
            GUILayout.Label("Current Xp : " + GameInformation.CurrentXp.ToString());

            GUILayout.EndVertical();
        }
        //PauseMenu Controls
        if (GUI.Button(new Rect(225, 305, Screen.width / 8, 20), "Resume"))
        {
            if (!CameraManipulation.x)
            {
                CameraManipulation.z     = false;
                CameraManipulation.pause = false;
            }
            if (CameraManipulation.x)
            {
                CameraManipulation.z = true;
            }
            PlayerUIManager.StatAdjustment();
        }
        if (GUI.Button(new Rect(225, 325, Screen.width / 8, 20), "Exit"))
        {
            Time.timeScale = 1;
            Application.LoadLevel("MainMenu");
            DestroyObject(gameObject);
        }
        if (GUI.Button(new Rect(225, 350, Screen.width / 8, 20), "Save"))
        {
            SaveInformation.Save();
            Debug.Log(GameInformation.RequiredXP);
        }

        WindowPlaceHolder = GUILayout.Window(WindowID, WindowPlaceHolder, _inventory, "Inventory");
    }
 public void Save()
 {
     saveInformation.Save();
 }
Exemplo n.º 6
0
 void Start()
 {
     questData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/StreamingAssets/Quests.json"));
     Quest();
     information.Save();
 }