public TintByState (TintBy action, Node target) : base (action, target) { DeltaB = action.DeltaB; DeltaG = action.DeltaG; DeltaR = action.DeltaR; staticSprite = Target.GetComponent<StaticSprite2D>(); if (staticSprite != null) { var color = staticSprite.Color; FromR = color.R; FromG = color.G; FromB = color.B; return; } shape = Target.GetComponent<Shape>(); if (shape != null) { FromR = shape.Color.R; FromG = shape.Color.G; FromB = shape.Color.B; return; } throw new NotSupportedException("The node should have StaticSprite2D or Shape component"); }
public TintByState(TintBy action, Node target) : base(action, target) { DeltaB = action.DeltaB; DeltaG = action.DeltaG; DeltaR = action.DeltaR; staticSprite = Target.GetComponent <StaticSprite2D>(); if (staticSprite != null) { var color = staticSprite.Color; FromR = color.R; FromG = color.G; FromB = color.B; return; } shape = Target.GetComponent <Shape>(); if (shape != null) { FromR = shape.Color.R; FromG = shape.Color.G; FromB = shape.Color.B; return; } throw new NotSupportedException("The node should have StaticSprite2D or Shape component"); }
public TintByState(TintBy action, Node target) : base(action, target) { DeltaB = action.DeltaB; DeltaG = action.DeltaG; DeltaR = action.DeltaR; DeltaA = action.DeltaA; ShaderParameterName = action.ShaderParameterName; MaterialIndex = action.MaterialIndex; staticSprite = Target.GetComponent <StaticSprite2D>(); if (staticSprite != null) { var color = staticSprite.Color; FromR = color.R; FromG = color.G; FromB = color.B; FromA = color.A; return; } var staticModel = Target.GetComponent <StaticModel>(); if (staticModel != null) { material = staticModel.GetMaterial(0); if (material != null) { var color = material.GetShaderParameter(ShaderParameterName); FromR = color.R; FromG = color.G; FromB = color.B; FromA = color.A; return; } else { throw new NotSupportedException("StaticModel.Material should not be empty."); } } throw new NotSupportedException("The node should have StaticSprite2D or StaticModel+Material component"); }