public bool Take(ColorVariant color) { float amount = 100; switch (color.colorId) { case 0: if (amount > greenAmount) { return(false); } greenAmount -= amount; return(true); case 1: if (amount > redAmount) { return(false); } redAmount -= amount; return(true); case 2: if (amount > blueAmount) { return(false); } blueAmount -= amount; return(true); } return(false); }
public void Shoot(TurretVariant variant, Vector3 offset, ColorVariant colorVariant, int colorVariantInt) { particleLauncher.transform.localPosition = variant.launcherOffset + offset; var collisionQuality = particleLauncher.collision; switch (colorVariantInt) { case 0: collisionQuality.collidesWith = LayerMask.GetMask("EnemyGreen"); break; case 1: collisionQuality.collidesWith = LayerMask.GetMask("EnemyRed"); break; case 2: collisionQuality.collidesWith = LayerMask.GetMask("EnemyBlue"); break; } this.variant = variant; this.colorVariantInt = colorVariantInt; particleColorGradient = colorVariant.gradient; this.colorVariant = colorVariant; ParticleSystem.MainModule psMain = particleLauncher.main; psMain.startColor = particleColorGradient.Evaluate(Random.Range(0f, 1f));; psMain.startSpeed = variant.speed; particleLauncher.Emit(1); shotSound.Play(); }
public void FillTank(ColorVariant color) { for (var i = 0; i < colorVariants.Length; i++) { if (colorVariants[i] == color) { colorVariant = i; // TODO ugh this is ugly break; } } tankState = turretVariant.tankSize; FindNewEnemy(); }
/* COLOR SCHEME * #A2BEFF #476EC7 #1C397E #C8D9FF #E4ECFF -- blue (hue 240) #FFBC37 #C78B15 #7F5500 #FFD580 #FFEDC8 -- orange (hue 60) * * base dark xdark light xlight * * S36L100 S64-L78 S78-L49 S22B100 S11L100 -- blue (hue 222) * S78L100 S89-L78 S100L50 S50L100 S22L100 -- orange (hue 40) */ public static string GetColor(ColorType type, ColorVariant variant, ColorShift shift = ColorShift.None) { int hue = (type == ColorType.Base ? 222 : 40); int saturation = 0; int luminosity = 0; switch (variant) { case ColorVariant.Base: saturation = 100; luminosity = 80; break; case ColorVariant.Dark: saturation = 50; luminosity = 50; break; case ColorVariant.XDark: saturation = 65; luminosity = 30; break; case ColorVariant.Light: saturation = 100; luminosity = 90; break; case ColorVariant.XLight: saturation = 100; luminosity = 95; break; default: throw new NotImplementedException(); } if (type == ColorType.Accent) { saturation *= 2; if (saturation > 100) { saturation = 100; } } switch (shift) { case ColorShift.SlightlyDarker: luminosity -= 2; break; case ColorShift.SlightlyLighter: luminosity += 2; break; default: // do nothing break; } Color color = ColorFromAhsb(100, hue, saturation / 100.0, luminosity / 100.0); return(String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B)); }
void UpdateColor() { turretColorVariant = colorVariants[colorVariant]; }