public int OnBulletHit(BulletHitInfo info) { //Debug.Log(string.Format("{0} Damage", gameObject.name));; var damageInt = Mathf.FloorToInt(info.Damage); health -= damageInt; if (health < maxHealth) { health = Mathf.Clamp(health, 0, maxHealth); } innerHealth = health; worldGUI.SendMessage( "DrawText", new WorldGUITextInfo() { text = damageInt.ToString(), position = info.HitPosition, }); gameObject.SendMessage( "OnDamage", SendMessageOptions.DontRequireReceiver); return(damageInt); }
private void OnTargetHit(BulletHitInfo hitInfo) { var hitHole = (Spatial)HitHoleScene.Instance(); AddChild(hitHole); hitHole.Translation = hitInfo.WorldCoords; BulletHitsTarget?.Invoke(hitInfo); }
private void OnBulletHitTarget(BulletHitInfo hitInfo) { var buildingHit = hitInfo.Building?.BuildingType; System.Diagnostics.Debug.WriteLine($"Hitting {hitInfo.Building?.BuildingType.ToString() ?? "Nothing"} at {hitInfo.WorldCoords}"); }
public int OnBulletHit(BulletHitInfo info) { //Debug.Log(string.Format("{0} Damage", gameObject.name));; var damageInt = Mathf.FloorToInt(info.Damage); health -= damageInt; if(health < maxHealth) { health = Mathf.Clamp(health, 0, maxHealth); } innerHealth = health; worldGUI.SendMessage( "DrawText", new WorldGUITextInfo() { text = damageInt.ToString(), position = info.HitPosition, }); gameObject.SendMessage( "OnDamage", SendMessageOptions.DontRequireReceiver); return damageInt; }