using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Shop : MonoBehaviour {
// Scripts
public PlayerInfo playerInfo;
//Canvas
public Canvas really;
public Canvas shop;
public Button yesBut;
public Button noBut;
public Button buySkin;
//variables
public int reallyCode;
public int mfb;
public int cfb;
public int buttonClickedOnObjectForBuy;
public bool oppAcc;
void Start ()
{
playerInfo = playerInfo.GetComponent<PlayerInfo>();
really = really.GetComponent<Canvas>();
yesBut = yesBut.GetComponent<Button>();
noBut = noBut.GetComponent<Button>();
buySkin = buySkin.GetComponent<Button>();
shop = shop.GetComponent<Canvas>();
//enabled
shop.enabled = true;
really.enabled = false;
}
void Update ()
{
}
public void BuyClicked()
{
if (buttonClickedOnObjectForBuy > 0)
{
really.enabled = true;
shop.enabled = false;
}
}
public void YesBut()
{
really.enabled = false;
shop.enabled = true;
if (playerInfo.gold >= mfb && playerInfo.crystals >= cfb)
{
playerInfo.gold = playerInfo.gold - mfb;
playerInfo.skin = buttonClickedOnObjectForBuy;
playerInfo.crystals = playerInfo.crystals - cfb;
}
if (playerInfo.gold < mfb || playerInfo.crystals < cfb)
{
playerInfo.skin = 999;
}
}
public void NoBut()
{
really.enabled = false;
shop.enabled = true;
}
public void Skin1()
{
buttonClickedOnObjectForBuy = 1;
mfb = 1000;
cfb = 5;
}
public void Skin2()
{
buttonClickedOnObjectForBuy = 2;
mfb = 4000;
cfb = 10;
}
}
public void Skin1()
{
buttonClickedOnObjectForBuy = 1;
mfb = 1000;
cfb = 5;
}
public void Skin2()
{
buttonClickedOnObjectForBuy = 2;
mfb = 4000;
cfb = 10;
}
}
public void YesBut()
{
oppAcc = true;
really.enabled = false;
shop.enabled = true;
}
if (Input.GetKeyDown(Fire))
{
Vector3 worldMousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector2 direction = (Vector2)((worldMousePos - transform.position));
direction.Normalize();
// Creates the bullet locally
GameObject bullet = (GameObject)Instantiate(
rocket,
transform.position + (Vector3)(direction * 0.5f),
Quaternion.identity);
// Adds velocity to the bullet
bullet.GetComponent<Rigidbody2D>().velocity = direction * speed
;
}.
Но все равно огромное спасибо за ответ, без Вас я бы не решил эту проблему.
_EndTimeSMS = EndTimeSMS.ToBinary().ToString();