You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Character.Student.cs 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Preparation.Utility;
  2. using Preparation.Interface;
  3. using System;
  4. using System.Threading;
  5. namespace GameClass.GameObj
  6. {
  7. public class Student : Character
  8. {
  9. public AtomicInt FixSpeed { get; } = new AtomicInt(0);
  10. /// <summary>
  11. /// 原初修理电机速度
  12. /// </summary>
  13. protected readonly int orgFixSpeed;
  14. public AtomicInt TreatSpeed { get; } = new AtomicInt(GameData.basicTreatSpeed);
  15. protected readonly int orgTreatSpeed;
  16. public IntInTheVariableRange GamingAddiction { get; } = new IntInTheVariableRange(0, 0);
  17. public AtomicInt TimeOfRescue { get; } = new AtomicInt(0);
  18. public Student(XY initPos, int initRadius, CharacterType characterType) : base(initPos, initRadius, characterType)
  19. {
  20. this.FixSpeed.SetReturnOri(this.orgFixSpeed = ((IStudentType)Occupation).FixSpeed);
  21. this.TreatSpeed.SetReturnOri(this.orgTreatSpeed = ((IStudentType)Occupation).TreatSpeed);
  22. this.GamingAddiction.SetPositiveMaxV(((IStudentType)Occupation).MaxGamingAddiction);
  23. }
  24. }
  25. public class Golem : Student, IGolem
  26. {
  27. private readonly object parentLock = new();
  28. private Character? parent; // 主人
  29. public Character? Parent
  30. {
  31. get
  32. {
  33. lock (parentLock)
  34. return parent;
  35. }
  36. set
  37. {
  38. lock (parentLock)
  39. {
  40. parent = value;
  41. }
  42. }
  43. }
  44. public override void AddScore(long add)
  45. {
  46. if (parent == null)
  47. base.AddScore(add);
  48. else parent.AddScore(add);
  49. }
  50. public Golem(XY initPos, int initRadius, Character? parent) : base(initPos, initRadius, CharacterType.Robot)
  51. {
  52. this.parent = parent;
  53. }
  54. }
  55. }