コード例 #1
0
 /*
  * private static void BAD_GenericCharacterMain_FixedUpdate(On.EntityStates.GenericCharacterMain.orig_FixedUpdate orig, GenericCharacterMain self)
  * {
  *  // Check for jump input first, since the base function resets input
  *  CharacterBody characterBody = ReflectionUtil.GetPropertyValue<CharacterBody>(self, "characterBody");
  *  string baseNameToken = ReflectionUtil.GetFieldValue<string>(characterBody, "baseNameToken");
  *  SurvivorIndex survivorIndex = SurvivorIndex.None;
  *  bool doJump = false;
  *  Debug.Log("Searching for name token == " + baseNameToken);
  *
  *  bool isAuthority = ReflectionUtil.GetPropertyValue<bool>(self, "isAuthority");
  *  if (isAuthority)
  *  {
  *
  *      if (characterBody && JumpOverrides.ContainsKey(survivorIndex))
  *      {
  *          Debug.Log("Jump override for: " + survivorIndex);
  *
  *          ReflectionUtil.InvokeMethod(self, "GatherInputs");
  *          CharacterMotor characterMotor = ReflectionUtil.GetPropertyValue<CharacterMotor>(self, "characterMotor");
  *          bool jumpInputRecieved = ReflectionUtil.GetFieldValue<bool>(self, "jumpInputReceived");
  *          int jumpCount = ReflectionUtil.GetFieldValue<int>(characterMotor, "jumpCount");
  *          int maxJumpCount = ReflectionUtil.GetPropertyValue<int>(characterBody, "maxJumpCount");
  *          if (jumpInputRecieved && jumpCount < maxJumpCount)
  *          {
  *              doJump = true;
  *          }
  *      }
  *  }
  *  // Now call orig and override, if needed
  *  orig.Invoke(self);
  *  if(doJump)
  *  {
  *      Debug.Log($"Entering jump override state {survivorIndex} for {characterBody.name}");
  *      self.outer.SetNextState(JumpOverrides[survivorIndex]);
  *  }
  * }
  */
 public static void AddSkillOverride(ExpandedSkillSlot skillSlot, SurvivorIndex survivor, EntityState activationState)
 {
     if (skillSlot != ExpandedSkillSlot.Jump)
     {
         SkillSlot baseSlot = skillSlot.ToBaseSkillSlot();
     }
     else
     {
         JumpOverrides[survivor] = activationState;
     }
 }
コード例 #2
0
        public static GenericSkill GetSkill(ExpandedSkillSlot expandedSlot, GameObject bodyPrefab)
        {
            GenericSkill skill = null;

            if (expandedSlot == ExpandedSkillSlot.Jump)
            {
                // Get jump skill when implemented...
            }
            else if (expandedSlot != ExpandedSkillSlot.None)
            {
                SkillLocator locator = bodyPrefab.GetComponent <SkillLocator>();
                skill = locator?.GetSkill(expandedSlot.ToBaseSkillSlot());
            }
            return(skill);
        }