You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

38 lines
919B

  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace coa4u
  5. {
  6. /// <summary>
  7. /// Instantly tints the target to the given color.
  8. /// </summary>
  9. class ActionSetTint : ActionInstant
  10. {
  11. public Vector4 color;
  12. protected const float coeff = 1F / 255F;
  13. public ActionSetTint(Vector4 tgtColor)
  14. : base()
  15. {
  16. color = tgtColor * coeff;
  17. }
  18. /// <summary>
  19. /// Returns a copy of the action.
  20. /// </summary>
  21. public override ActionInstant clone()
  22. {
  23. return new ActionSetTint(color * 255F);
  24. }
  25. /// <summary>
  26. /// This method is called at the action start.
  27. /// </summary>
  28. public override void start()
  29. {
  30. base.start();
  31. renderer.material.color = new Color(color[0], color[1], color[2], color[3]);
  32. }
  33. }
  34. }