Ejemplo n.º 1
0
 private void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     mouseController = FindObjectOfType <TargetMouseSelected>();
     myRigidbody     = GetComponent <Rigidbody2D>();
     myAnimator      = GetComponent <Animator>();
     selectable      = GetComponent <Selectable>();
     teamData        = GetComponent <TeamData>();
     unitParent      = transform.parent.parent.GetChild(2).gameObject;
     health          = GetComponent <Health>();
     sellProfit      = buyCost / 2;
     currentUnits    = new Health[3];
     if (teamData.GetTeamBelonging() == Team.TeamRed)
     {
         spawnTimeInSeconds -= GlobalUpgrades.instance.GetUpgradeValueOnUpgradesIndex(1);    // Index 1 is spawnTimeUpgrade
         unitManager         = FindObjectOfType <UnitManagerPanel>();
     }
     if (dwellingUpgrader == null)
     {
         dwellingUpgrader = GetComponentInChildren <DwellingUpgrader>();
     }
 }