public override void Execute(ActorModel model) { if (vfxPrefab == null) { return; } if ((int)model.currentFrame == model.previousFrame) { return; } //normalizedTime += 1 / (endFrame - startFrame); //if (particle != null) //{ // particle.Simulate(normalizedTime, true, true, false); //} }
/// <summary> /// A Method to apply Behavior Attack infomation /// </summary> /// <param name="attacker"></param> void ApplyHitInfo(ActorModel attacker, Transform atkTransform, AttackBase currentAtk) { // get the attacker's attackinfo ExecuteHurtBehavior(currentAtk, atkTransform); //ApplyHurtFX(hitPoint); // reset hit pause Time ApplyHitPauseTime(attacker, currentAtk); // Apply the hit force that character received from attacker ApplyHitForce(currentAtk, atkTransform.forward); // apply the get hit vfx such as blood, impact... ApplyHitFx(currentAtk, hitPoint); model.DecreaseHealth(currentAtk.hitDmg); }
public override void Execute(ActorModel model) { if (sfx == null) { Debug.Log("Can't find sfx audio clip!"); return; } if ((int)model.currentFrame == model.previousFrame) { Debug.Log("Is previous frame"); return; } model.audioSource.pitch = model.objectTimeScale; model.audioSource.outputAudioMixerGroup.audioMixer.SetFloat("pitchBend", 1f / model.objectTimeScale); model.audioSource.PlayOneShot(sfx); CombatDebugger.Log("Play Audio", LogDomain.BehaviorAcrion); }
public override void Exit(ActorModel model) { // if ((int)model.currentFrame == model.previousFrame) return; if (disableWhenExit) { if (particles != null) { foreach (var particle in particles) { if (particle != null) { particle.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); } } } } }
Transform CheckForAttachment(ActorModel model) { Transform parent = null; if (attachSelf) { if (string.IsNullOrEmpty(selfParentName)) { parent = model.character.transform; } else { parent = model.character.transform.Find(selfParentName); } } else if (attachTarget) { parent = model.target.character.transform; } return(parent); }
void JoyStickMovement(float power, ActorModel model) { if (model.actorType == ActorType.PLAYER) { model.moveInputDir = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")); model.animMoveSpeed = Mathf.SmoothDamp(model.animMoveSpeed, model.moveInputDir.magnitude, ref moveSmoothVelocity, 0.1f); } if (model.moveInputDir.sqrMagnitude > 1) { model.moveInputDir.Normalize(); } Vector3 moveDir = Vector3.zero; if (model.moveInputDir != Vector2.zero) { moveDir = new Vector3(model.moveInputDir.x, 0, 0); } model.velocity = new Vector3(moveDir.x * power, model.velocity.y, 0); HandleRotation(model.moveInputDir, model); }
public override void Execute(ActorModel model) { JoyStickMovement(moveSpeed, model); }
public override void Execute(ActorModel model) { model.CanCancel = cancelThreshold > 0f; }
/// <summary> /// The Condition Requirement to execute this behavior /// </summary> /// <param name="model"> ActorMode object </param> /// <returns></returns> public bool MetRequirements(ActorModel model) { if (!isActivated) { return(false); } // if character has recovered from an attack? //if (model.HitRecoverFrames > 0) //{ // return false; //} // if this behavior require character to be grounded? if (requireGrounded) { if (!model.cc.isGrounded) { CombatDebugger.Log("Grounded requirement failed", LogDomain.BehaviorRequirement); return(false); } } if (requireRunning) { if (model.moveInputDir.magnitude <= 0.75f) { CombatDebugger.Log("Running requirement failed", LogDomain.BehaviorRequirement); return(false); } } // if this behavior require character to be in the air? if (requireAerial) { if (!model.isAerial) { CombatDebugger.Log("In Air requirement failed", LogDomain.BehaviorRequirement); return(false); } } // if this behavior require to have a target? if (requireTarget) { if (model.target == null) { return(false); } } // if this behavior can force cancel other behaviors? if (canForceExecute && !model.currentBehavior.canForceExecute && !model.currentBehavior.isHurtBehavior) { // Disable Hitbox when force execute Behavior model.CanCancel = true; if (model.hitBox != null) { model.hitBox.SetActive(false); model.hitBox.SetLocalScale(Vector3.zero); } } if (requireUnderAttack) { if (model.currentBehavior.isHurtBehavior) { model.CanCancel = true; } else { return(false); } } // if this behavior can be canncel? if (model.CanCancel == false) { CombatDebugger.Log("CanCancel requirement failed", LogDomain.BehaviorRequirement); return(false); } else { model.CanCancel = false; } // if the behavior have CoolDown if (cooldown > 0) { if (!cdTimer.IsTimeUp) { CombatDebugger.Log("Cooldown requirement failed", LogDomain.BehaviorRequirement); return(false); // if count down haven't finish, return } ResetTimer(cooldown); cdTimer.Start(); // Start count down again } // if the character have enough energy to execute this behavior if (model.actorStats.currentEnergy < energyPointCost) { CombatDebugger.Log("PowerMeter requirement failed", LogDomain.BehaviorRequirement); return(false); } // if the character have enough air jump points to execute this behavior if (model.actorStats.currentAirJumpPoint < airJumpPointCost) { CombatDebugger.Log("AirJumpPoints requirement failed", LogDomain.BehaviorRequirement); return(false); } // if passing all the conditions, then return true return(true); }
/// <summary> /// Constructor /// </summary> /// <param name="model"></param> public ActorFSM(ActorModel model) { this.model = model; fps = 1.0f / GameManager_Settings.targetFrameRate; }
/// <summary> /// A virtual method of updating the behavior action event in Editor Mode /// </summary> /// <param name="model"></param> public virtual void ExecuteInEditor(ActorModel model, float normalizedTime) { }
/// <summary> /// A virtual mehtod of exiting the behavior action event /// </summary> /// <param name="model"></param> public virtual void Exit(ActorModel model) { }
/// <summary> /// A virtual mehtod of updating the behavior action event /// </summary> /// <param name="model"></param> public virtual void Execute(ActorModel model) { }
/// <summary> /// A virtual mehtod of entering the behavior action event /// </summary> /// <param name="model"></param> public virtual void Enter(ActorModel model) { }
public Buff(string buffName, ActorModel model) { this.affectedModel = model; this.buffName = buffName; }
/// <summary> /// Disable the Attack /// </summary> /// <param name="model"></param> public void DeactiveHitBox(ActorModel model) { model.hitBox.SetLocalScale(Vector3.zero); model.hitBox.SetActive(false); }
public override void Execute(ActorModel model) { model.velocity.y += yDirForce; }