public override WeaponColors GetColors() { // If there are no charging colors, there is no need // to check the charge level and return the right colors. if (chargeColors == null) { return(baseColors); } // If fully charged, the right colors are decided based on Unity's timer. if (charge > 1.0f) { if (chargeColors.Length >= 2) { int index = Mathf.FloorToInt((Time.unscaledTime % 0.2f) * 15.0f); WeaponColors colors = chargeColors[1, index]; if (owner) { switch (index) { case 0: colors.colorDark = owner.defaultColors.colorLight; colors.colorOutline = owner.defaultColors.colorDark; break; case 1: colors.colorLight = owner.defaultColors.colorDark; colors.colorOutline = owner.defaultColors.colorLight; break; case 2: colors.colorOutline = owner.defaultColors.colorLight; colors.colorLight = owner.defaultColors.colorDark; break; } } return(colors); } } // If semi charged, the right colors are decided based on Unity's timer. else if (charge > 0.3f) { if (chargeColors.Length >= 1) { int index = Mathf.FloorToInt((Time.unscaledTime % 0.3f) * 10.0f); return(chargeColors[0, index]); } } // If not charged, returns the default colors. return(baseColors); }
// Each Player Weapon Data has a few variables by default, // which always need to be assigned. Each class can have // additional arguments in its constuctor, but these // will always need to be assigned. public Pl_WeaponData(Player _owner, string _menuName, WeaponColors _baseColors, WeaponColors[,] _chargeColors) { // owner is the Player who is currently using a weapon. // In the WeaponList this will always be null, as it will // be assigned by the player themselves when they equip this weapon. owner = _owner; // baseColors are the Weapon Colors the player will use // when they are equiped with this weapon. // If the alpha of one of these colors is 0, the player // will use their default color instead. baseColors = _baseColors; // If the weapon can be charged, the colors the player will use // in each charge level can be assigned here. // If not, this can just be null instead. chargeColors = _chargeColors; // This is the name the weapon will show in the pause menu. // Try to keep it short! menuName = _menuName; }
public PlWpDt_RushJet(Player _owner, string _menuName, WeaponColors _baseColors, WeaponColors[,] _chargeColors) : base(_owner, _menuName, _baseColors, _chargeColors) { }
public PlWpDt_BlackHoleBomb(Player _owner, string _menuName, WeaponColors _baseColors, WeaponColors[,] _chargeColors) : base(_owner, _menuName, _baseColors, _chargeColors) { }