/// <summary>
 /// Used when upgrading-- copies the current unit's stats to the new one. 
 /// </summary>
 /// <param name="target">the GameEntity that will acquire this one's stats</param>
 public void CloneData(GameEntity target)
 {
     target.owner = owner;
     target.currentHP = target.maxHP - (maxHP - currentHP);
 }
 // Use this for initialization
 void Start()
 {
     Messenger<GameEntity>.RegisterListener("GameEntityPressed", x => { currentSelection = x; });
     Messenger<Gridmap>.RegisterListener("MapPressed", t => { currentSelection = null; });
 }
Example #3
0
 /// <summary>
 /// Remove a unit from the registry of attackone ones.
 /// <summary>
 /// <param name="u">The unit to remove from the registry</param>
 /// <returns>True if the unit was removed, false if it wasn't found in the registry.</returns>
 public static bool UnregisterAttackableUnit(GameEntity u)
 {
     return unitRegistry.Remove(u);
 }
Example #4
0
 /// <summary>
 /// Add a unit to the registry of attackable ones.
 /// </summary>
 /// <param name="u">The unit to add the the registry</param>
 public static void RegisterAttackableUnit(GameEntity u)
 {
     unitRegistry.Add(u);
 }
Example #5
0
        private bool TryAttack()
        {
            GameEntity target = CheckForTarget();

            if (!target) return false;

            Projectile.FireNew(projectileBase, transform.position, target, Random.Range(minDamage, maxDamage));
            currentTarget = target;
            return true;
        }
 public void Fire(GameEntity t, float d)
 {
     target = t;
     tpos = target.transform.position;
     damage = d;
 }
 public static void FireNew(Projectile proj, Vector3 origin, GameEntity t, float d)
 {
     Projectile newProj = Instantiate(proj) as Projectile;
     newProj.transform.position = origin;
     newProj.Fire(t, d);
 }