Attributes.cs 731 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Tutorial025.Models
  7. {
  8. public class Attributes
  9. {
  10. public int HealthPoint { get; set; }
  11. public float Speed { get; set; }
  12. public static Attributes operator +(Attributes a, Attributes b)
  13. {
  14. return new Attributes()
  15. {
  16. HealthPoint = a.HealthPoint + b.HealthPoint,
  17. Speed = a.Speed + b.Speed,
  18. };
  19. }
  20. public static Attributes operator -(Attributes a, Attributes b)
  21. {
  22. return new Attributes()
  23. {
  24. HealthPoint = a.HealthPoint - b.HealthPoint,
  25. Speed = a.Speed - b.Speed,
  26. };
  27. }
  28. }
  29. }