void onHitterActivated(ActivatableHitter hitter, Hashtable parameters) { if (hitter.HitterType == HitterType.BLADE) { cut(hitter.transform); } }
void onHitterActivated(ActivatableHitter activatableHitter, Hashtable parameters) { if (activatableHitter.HitterType == HitterType.BLADE) { this.transform.forward = -this.transform.forward; setSpeed(); } }
void onHitterActivated(ActivatableHitter hitter, Hashtable parameters) { OnHitterActivated?.Invoke(hitter, parameters); if (sendMessageEnabled) { Hashtable feedbackParameters = new Hashtable(); feedbackParameters.Add(ParameterType.SENDER_TYPE, senderType); hitter.SendMessage(feedbackParameters); } }
private void OnTriggerExit(Collider other) { Hitter hitter = other.transform.gameObject.GetComponent <Hitter>(); if (hitter != null) { OnHitterExit?.Invoke(hitter); if (hitter is ActivatableHitter) { ActivatableHitter activatableHitter = (ActivatableHitter)hitter; if (registeredHitters.Contains(activatableHitter)) { activatableHitter.OnActivate -= onHitterActivated; int index = registeredHitters.IndexOf(activatableHitter); registeredHitters.RemoveAt(index); } } } }
private void OnTriggerEnter(Collider other) { Hitter hitter = other.transform.gameObject.GetComponent <Hitter>(); if (hitter != null && hitter.gameObject.activeInHierarchy) { OnHitterEnter?.Invoke(hitter); if (hitter.GetType() == typeof(ActivatableHitter)) { ActivatableHitter activatableHitter = (ActivatableHitter)hitter; if (activatableHitter.IsActive) { onHitterActivated(activatableHitter, activatableHitter.LastParameters); } else if (!registeredHitters.Contains(activatableHitter)) { activatableHitter.OnActivate += onHitterActivated; registeredHitters.Add(activatableHitter); } } } }
void onHitterActivated(ActivatableHitter hitter, Hashtable parameters) { if (!IsGrounded) { Vector3 velocity = this.Velocity; velocity.y = 5.5f; SetVelocity(velocity); } if (hitter != null && hitter.HitterType == HitterType.BLADE) { if (parameters != null && parameters.ContainsKey(ParameterType.ATTACK_TYPE)) { WeaponActionType attackType = (WeaponActionType)parameters [ParameterType.ATTACK_TYPE]; Hashtable feedbackParameters = new Hashtable(); feedbackParameters.Add(ParameterType.SENDER_TYPE, SenderType.NPC); if (mainMovementState != null && mainMovementState is NPCGroundState && Random.value < 0.1f && attackType != WeaponActionType.DOWNWARD_SMASH) { attackType = WeaponActionType.BLOCK; feedbackParameters.Add(ParameterType.ATTACK_TYPE, WeaponActionType.BLOCK); } hitter.SendMessage(feedbackParameters); switch (attackType) { case WeaponActionType.SLASH: onHit(hitter); break; case WeaponActionType.UPPERCUT: upperCut(); break; case WeaponActionType.STAB: stab(); break; case WeaponActionType.BLOCK: block(); break; case WeaponActionType.DOWNWARD_SMASH: smashed(); break; } } } }