Example #1
0
    public override void Die()
    {
        if (isAlive)
        {
//			isAlive = false;
            if (player)
            {
                player.stratPoints.RemoveStratPt(this);
            }

//			player.RemoveFromWOsDick (this as WorldObject);
            occupied = false;
            foreach (SpeciesUnitTrainer unitTrainer in connectedSpeciesTrainers)
            {
                unitTrainer.mainStratPoint = null;
                Destroy(unitTrainer.stratLine.gameObject);
            }
            connectedSpeciesTrainers.Clear();
            foreach (StatsType statsType in statsDick.Keys)
            {
                for (int i = 0; i < statsDick[statsType].Length; i++)
                {
                    statsDick[statsType][i] = GetLocalStat(statsType, i);
                }
            }
            buildingArea.SetSpecies(Species.NonPlayer);
//			healthBar.ResetBar ();
//			healthBar.gameObject.SetActive (false);
            if (flag)
            {
                flag.GetComponent <SpriteRenderer> ().color = Color.white;
                flag.gameObject.SetActive(false);
            }
            buttons.Clear();
//			if (selected)
//			{
//				Deselect();
//				GameManager.playersDick[player.species].userInput.SelectedObjects.Remove(this as WorldObject);
//			}
            StrategicPointTransform.StartRevertCoroutine(this);
        }
        base.Die();
        if (player)
        {
            player = null;
            SetLayer();
        }
    }
 private void Awake()
 {
     thisTransform   = transform;
     thisSPTransform = this;
 }