private void Start() { if (instance == null) { instance = this; } else { Destroy(this); } }
// 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>(); } }