Inheritance: MonoBehaviour
コード例 #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     if (instance != this)
     {
         Destroy(this);
     }
 }
コード例 #2
0
ファイル: WorldManager.cs プロジェクト: RocketSurgery/DDRGame
    void Awake()
    {
        backgroundMusic = SoundManager.singleton.instance.Play2DSong("FloppyDrift", 1.0f, true);

        allCameraLayers = Camera.main.cullingMask;
        currentOffice = null;

        governmentItems = GameObject.FindGameObjectsWithTag("GovernmentStuff");
        foreach (GameObject go in governmentItems)
        {
            go.SetActive(false);
        }
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     officeGenerator = GameObject.FindObjectOfType <OfficeGenerator>();
     canvas          = GameObject.Find("PurchaseFacilityCanvas").GetComponent <Canvas>();
     facilityList    = FacilityList.instance;
     toggleGroup     = GetComponent <ToggleGroup>();
     playerStats     = PlayerStats.instance;
     confirmButton   = canvas.transform.Find("PurchaseButton").GetComponent <Button>();
     foreach (FacilityInfo facility in facilityList.facilityList)
     {
         if (facility.facilityType != FacilityInfo.FacilityType.Empty && facility.facilityType != FacilityInfo.FacilityType.Copy)
         {
             GameObject newButton = GameObject.Instantiate(buttonPrefab, this.transform);
             newButton.GetComponent <Toggle>().group = toggleGroup;
             newButton.transform.Find("Name").GetComponent <Text>().text         = facility.facilityName;
             newButton.transform.Find("CostToBuy").GetComponent <Text>().text    = "Purchase: $" + facility.costToBuy.ToString("0.00");
             newButton.transform.Find("CostPerMonth").GetComponent <Text>().text = "Monthly Cost: $" + facility.baseMonthlyExpenses.ToString("0.00");
         }
     }
 }
コード例 #4
0
ファイル: OfficeManager.cs プロジェクト: javibm/LudumDare40
 public OfficeManager(int initialSize, OfficeGenerator officeGenerator, OfficeStats officeStats)
 {
     this.officeGenerator = officeGenerator;
     this.officeGenerator.InitOffice(initialSize);
     this.officeStats = officeStats;
 }
コード例 #5
0
 void Start()
 {
     officeGen = GameObject.Find("Elevator").GetComponent<OfficeGenerator>();
     numberLeft = officeGen.numberOfOffices;
 }