Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.SceneManagement;
  4.  
  5. class CastleInfo
  6. {
  7.     private string _name;
  8.     private int _gold,_population;
  9.     public string CastleName
  10.     {
  11.         get
  12.         {
  13.             return _name;
  14.         }
  15.         set
  16.         {
  17.             _name = value;
  18.         }
  19.     }
  20.     public int CastleGold
  21.     {
  22.         get
  23.         {
  24.             return _gold;
  25.         }
  26.         set
  27.         {
  28.             _gold = value;
  29.         }
  30.     }
  31.     public int CastlePopulation
  32.     {
  33.         get
  34.         {
  35.             return _population;
  36.         }
  37.         set
  38.         {
  39.             _population = value;
  40.         }
  41.     }
  42. }
  43.  
  44. public class CastleChose : MonoBehaviour
  45. {
  46.     public int random = 0;
  47.    
  48.    
  49.     CastleInfo MyCastle = new CastleInfo();      
  50.    
  51.     void OnMouseOver()
  52.     {
  53.        
  54.         if (Input.GetMouseButtonDown(0))
  55.         {
  56.            
  57.                 random = Random.Range(1, 10) * 10;
  58.                 MyCastle.CastleName = gameObject.name;
  59.                 MyCastle.CastlePopulation = 1000 - random;
  60.                 MyCastle.CastleGold = 11000 - (MyCastle.CastlePopulation * 4);
  61.                 print(MyCastle.CastleName + " < nazwa");
  62.                 print(MyCastle.CastleGold + " < złoto");
  63.                 print(MyCastle.CastlePopulation + " < Populacia");
  64.            
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement