public void DoDamageToTileEntity(TileEntity te, int damage) { int damageDealt = te.TakeDamage(damage); Debug.Log(te.GetName() + " was shot for " + damageDealt + " damage "); EntityInfo info = gameInfo.GetEntityInfoOrDefault(te.GetUid(), CreateBaseEntityInfoFromTileEntity(te)); gameInfo.UpdateOrAddToEntityInfoDictionary(info); }
private void UpdateTileEntityFromNewGameInfo(TileEntity tileEntity, EntityInfo entityInfo) { if (tileEntity != null /* && tileEntity.MyTileEntityType == TileEntity.TileEntityType.Player*/) { //TileEntity tileEntity = (TileEntity)tileEntity; if (tileEntity.Health != entityInfo.Health) { //calculate and distribute incoming damage int damageToTake = tileEntity.Health - entityInfo.Health; tileEntity.TakeDamage(damageToTake); } } }
public float DealDamage(TileEntity te) { float damageDealt = this.baseDamage - te.TakeDamage(this.baseDamage); return(damageDealt); }