Exemple #1
0
        public void RepairUnit(Selectable s)
        {
            Health h    = s.GetComponent <Health>();
            float  cost = s.Data.Cost * ((h.InitialHealth - h.HealthValue) / h.InitialHealth);

            Data.Credits -= cost;
            h.HealthValue = h.InitialHealth;
        }
Exemple #2
0
        void KillMe(Selectable go)
        {
            Instantiate(Explosion, go.transform.position, go.transform.rotation);
            Selection.Remove(go.GetComponent <Selectable>());
            Bounds.SetUnits(Selection);
            go.transform.parent = null;
            MyTeam.GetComponent <LimitsMan>().CheckBuild(go.Data.Type);

            GameObject.Destroy(go.gameObject, 0.5f);
        }
Exemple #3
0
 void SlowUpdate()
 {
     if (Target != null)
     {
         Health h = Target.GetComponent <Health>();
         HealthText.text = Mathf.RoundToInt(h.HealthValue / h.InitialHealth * 100).ToString() + "%";
         CostText.text   = Target.Data.Cost.ToString();
     }
     else
     {
         HealthText.text = "???";
         CostText.text   = "???";
     }
 }