예제 #1
0
        public override List <string> GetDataForSave()
        {
            List <GameObject> balls = Mirror.GetMirror().Balls;
            List <string>     data  = (from ball in balls select ball.name).ToList();

            return(data);
        }
예제 #2
0
 public static Mirror GetMirror()
 {
     if (_instance == null)
     {
         GameObject instanceObject = new GameObject();
         _instance = instanceObject.AddComponent <Mirror>();
     }
     return(_instance);
 }
예제 #3
0
 public bool TryBuySomething(uint price, GameObject prefab)
 {
     if (m_playerWallet.CanDecreaseMoney(price))
     {
         Mirror.GetMirror().AddBall(prefab);
         OnSuccessBuy?.Invoke();
         m_playerWallet.DecreaseMoney(price);
         return(true);
     }
     OnFailedToBuy?.Invoke();
     return(false);
 }
예제 #4
0
        public void Shoot()
        {
            m_cannonballRigidbody.constraints = RigidbodyConstraints.None;
            float sliderAmount = FindObjectOfType <FireButtonSlider>().SliderAmount;

            m_cannonballRigidbody.AddForce(m_cannonballRigidbody.transform.forward * m_startImpulsePower * (1 + sliderAmount));
            m_cannonballRigidbody.AddTorque(m_cannonballRigidbody.transform.right * m_startImpulsePower * (1 + sliderAmount));
            m_cannonballRigidbody.transform.parent = null;
            m_cannonballRigidbody.GetComponent <CannonBall>().SetAppearance(Mirror.GetMirror().CurrentBall);
            m_shootParticleSystem.Play();
            OnShoot();
            m_cannonballRigidbody.GetComponent <CannonBall>().enabled = true;
        }
예제 #5
0
 public override void LoadData(List <string> data)
 {
     BuyButton[] shopButtons = FindObjectsOfType <BuyButton>();
     for (int i = 0; i < data.Count; i++)
     {
         foreach (var button in shopButtons)
         {
             if (button != null && button.TargetPrefab.name == data[i])
             {
                 GameObject soldTextPrefab = UnityEngine.Resources.Load("Prefabs/SoldText") as GameObject;
                 Instantiate(soldTextPrefab, button.transform.position, Quaternion.identity);
                 Mirror.GetMirror().AddBall(button.TargetPrefab);
                 Destroy(button.gameObject);
             }
         }
     }
 }
예제 #6
0
 private void Awake()
 {
     _instance = this;
 }