This is my Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShopSystem : MonoBehaviour
{
public int money;
public int wechsel;
public GameObject Text2;
public GameObject Text3;
public GameObject Text4;
void Start()
{
if (PlayerPrefs.GetInt("Skin2Text", 0) == 1)
{
Text2.SetActive(false);
}
if (PlayerPrefs.GetInt("Skin3Text", 0) == 1)
{
Text3.SetActive(false);
}
if (PlayerPrefs.GetInt("Skin4Text", 0) == 1)
{
Text4.SetActive(false);
}
wechsel = PlayerPrefs.GetInt("wechsel", 0);
}
void Skin1()
{
wechsel = 1;
PlayerPrefs.SetInt("wechsel", wechsel);
}
public void Skin2()
{
money = PlayerPrefs.GetInt("Money", 0);
if (PlayerPrefs.GetInt("Skin2Text",0) < 1)
{
if(money - 100 >= 0)
{
Text2.SetActive(false);
money -= 100;
PlayerPrefs.SetInt("Money", money);
PlayerPrefs.SetInt("Skin2Text", 1);
}
}
if (PlayerPrefs.GetInt("Skin2Text", 0) ==1)
{
wechsel = 2;
PlayerPrefs.SetInt("wechsel", wechsel);
}
}
}
public void Skin3()
{
money = PlayerPrefs.GetInt("Money", 0);
if (PlayerPrefs.GetInt("Skin3Text",0) < 1)
{
if(money - 250 >= 0)
{
Text3.SetActive(false);
money -= 250;
PlayerPrefs.SetInt("Money", money);
PlayerPrefs.SetInt("Skin3Text", 1);
}
}
if (PlayerPrefs.GetInt("Skin3Text", 0) ==1)
{
wechsel = 3;
PlayerPrefs.SetInt("wechsel", wechsel);
}
}
public void Skin4()
{
money = PlayerPrefs.GetInt("Money", 0);
if (PlayerPrefs.GetInt("Skin4Text",0) < 1)
{
if(money - 500 >= 0)
{
Text4.SetActive(false);
money -= 500;
PlayerPrefs.SetInt("Money", money);
PlayerPrefs.SetInt("Skin4Text", 1);
}
}
if (PlayerPrefs.GetInt("Skin4Text", 0) ==1)
{
wechsel = 4;
PlayerPrefs.SetInt("wechsel", wechsel);
}
}
These are the errors:
Assets\Scripts\Managment\ShopSystem.cs(59,5): error CS8803: Top-level statements must precede namespace and type declarations.
Assets\Scripts\Managment\ShopSystem.cs(59,5): error CS0106: The modifier 'public' is not valid for this item
Assets\Scripts\Managment\ShopSystem.cs(78,5): error CS0106: The modifier 'public' is not valid for this item
pls help.
↧