public ColorReducer(PixelFormat targetPf) { initLookups(); switch (targetPf) { case PixelFormat.pf4444: downgr = (int a, int cNum) => { //return downgrade(a, 4); return(lookup4 [a]); }; break; case PixelFormat.pf565: downgr = (int a, int cNum) => { if (cNum == 1) { return(downgrade(a, 6)); } if ((cNum == 0) || (cNum == 2)) { return(downgrade(a, 5)); } return(255); }; break; case PixelFormat.pf5551: downgr = (int a, int cNum) => { if ((cNum >= 0) && (cNum <= 2)) { return(downgrade(a, 5)); } if (cNum == 3) { return(downgrade(a, 1)); } return(255); }; break; } }
// Take the first Downgrade from TowerDowngrades, apply the downgrade and then remove it from the list. // returns true if performed successfully public bool PerformDowngrade() { if (initialized == false) { Debug.LogError("TowerDowngradeScript is not yet initialized!"); return(false); } // Check if the list is empty, if it is empy, we already applied all the downgrades that are possible. if (towerDowngrades.Count == 0) { Debug.LogError("PerformDowngrade was called but there aren't any downgrades in the list"); return(false); } // Save the data for the downgrade Downgrade dg = towerDowngrades[0]; // before continuing check if the player has enough money for the downgrade! if (GameController.instance.Money < dg.Cost) { return(false); } // Remove the downgrade from the list towerDowngrades.RemoveAt(0); // Increase the downgradeLevel which is only used to keep track of how many downgrades we performed and what our current level is. downgradeLevel++; // Reduce the towers stats tower.Damage -= dg.DamageSubtraction; tower.Range -= dg.RangeSubtraction; tower.FireRate -= dg.FireRateSubtraction; Vector2 offset = new Vector2(0, 1f); GameController.instance.GainMoney(-dg.Cost, (Vector2)tower.gameObject.transform.position + offset); return(true); }
public ColorReducer(PixelFormat targetPf) { initLookups (); switch (targetPf) { case PixelFormat.pf4444: downgr = (int a, int cNum) => { //return downgrade(a, 4); return lookup4 [a]; }; break; case PixelFormat.pf565: downgr = (int a, int cNum) => { if (cNum == 1) { return downgrade (a, 6); } if ((cNum == 0) || (cNum == 2)) { return downgrade (a, 5); } return 255; }; break; case PixelFormat.pf5551: downgr = (int a, int cNum) => { if ((cNum >= 0) && (cNum <= 2)) { return downgrade (a, 5); } if (cNum == 3) { return downgrade (a, 1); } return 255; }; break; } }
public async Task Remove(Downgrade downgrade) { _context.Downgrades.Remove(downgrade); }
void IDBMigrationStep.Downgrade(IDBIO db) { Downgrade?.Invoke(db); }
public bool HasDowngrade(Downgrade downgrade) { return(m_Downgrades.Contains(downgrade)); }
public void GiveDowngrade(Downgrade downgrade) { m_Downgrades.Add(downgrade); }