예제 #1
0
 public AttackMove(string stateName, float damageMultiplier, AttackType type, AttackForce force)
 {
     this.stateName        = stateName;
     this.type             = type;
     this.damageMultiplier = damageMultiplier;
     this.force            = force;
 }
예제 #2
0
    public void AttemptDamage(float q, Vector3 direction, int attackerViewId, AttackForce force)
    {
        if (photonView.IsMine)
        {
            Character attacker = PhotonView.Find(attackerViewId).GetComponent <Character>();

            if (!isEvading && timeSinceLastDamage > 0.5f)
            {
                Debug.Log(attacker.gameObject.name + " attempted damage on " + gameObject.name);

                if (isBlocking && Vector3.Angle(transform.forward, attacker.transform.forward) > 90f)
                {
                    // This character blocked the incoming attack
                    photonView.RPC("PlayState", RpcTarget.All, "Block Hit", 0.2f);

                    string[] clips = { SoundClips.BLOCK_01, SoundClips.BLOCK_02 };
                    photonView.RPC("PlaySound", RpcTarget.All, clips[Random.Range(0, clips.Length)]);

                    ConsumeStamina(q);

                    if (stamina <= 0f)
                    {
                        OnBlockStaminaRunout(force);
                    }

                    timeSinceLastDamage = 0f;

                    // Knockback for blocking
                    Debug.Log("Knockbacking for " + (direction.normalized * 10f).magnitude);
                    motor.velocity = direction.normalized * 10f;
                }
                else
                {
                    // The incoming attack must succesfully damage this character
                    Damage(q, direction);

                    if (health > 0f)
                    {
                        //Flinch(direction.normalized * 8f);
                        poise -= q;
                    }

                    // Play the blood effect
                    EffectManager.instance.PlayBlood(weaponObject.transform.position, attacker.transform.forward);

                    string[] clips = { SoundClips.DAMAGE_01, SoundClips.DAMAGE_02, SoundClips.DAMAGE_03 };
                    photonView.RPC("PlaySound", RpcTarget.All, clips[Random.Range(0, clips.Length)]);
                }
            }
        }
    }
예제 #3
0
 public void OnBlockStaminaRunout(AttackForce force)
 {
     if (isBlocking)
     {
         if (force == AttackForce.Huge)
         {
             photonView.RPC("PlayState", RpcTarget.All, "Knockback", 0f);
         }
         else
         {
             photonView.RPC("PlayState", RpcTarget.All, "Stun", 0.2f);
         }
     }
 }