Example #1
0
 public override string GetMoveAnim(E_MotionType motion, E_MoveType move, E_WeaponType weapon, E_WeaponState weaponState)
 {
     if (weaponState == E_WeaponState.NotInHands)
     {
         return("walk");
     }
     else
     {
         if (move == E_MoveType.Forward)
         {
             return("combatMoveF");
         }
         else if (move == E_MoveType.Backward)
         {
             return("combatMoveB");
         }
         else if (move == E_MoveType.StrafeRight)
         {
             return("combatMoveR");
         }
         else
         {
             return("combatMoveL");
         }
     }
 }
Example #2
0
    public override float GetWeaponAnimTime(E_WeaponType type, E_WeaponAction action)
    {
        string animName;

        switch (action)
        {
        case E_WeaponAction.Switch:
            animName = WeaponAnimations[type].SwitchIdle;
            break;

        case E_WeaponAction.Fire:
            animName = BlackBoard.MotionType == E_MotionType.None ? WeaponAnimations[type].FireIdle : WeaponAnimations[type].FireRun;
            break;

        case E_WeaponAction.Reload:
            animName = BlackBoard.MotionType == E_MotionType.None ? WeaponAnimations[type].ReloadIdle : WeaponAnimations[type].ReloadRun;
            break;

        default:
            throw new System.NotImplementedException();
        }

        if (animName != null && Animation[animName] != null)
        {
            return(Animation[animName].length);
        }

        return(0);
    }
Example #3
0
 public bool Decode(BinaryDecoder decoder)
 {
     if (!BinaryCodec.Decode(decoder, out _itemID))
     {
         return(false);
     }
     if (!BinaryCodec.DecodeUnicodeString(decoder, out _itemName))
     {
         return(false);
     }
     if (!BinaryCodec.DecodeUnicodeString(decoder, out _itemDesc))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _iconName))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _price))
     {
         return(false);
     }
     {
         int enumValue = 0;
         if (!BinaryCodec.Decode(decoder, out enumValue))
         {
             return(false);
         }
         _weaponType = (E_WeaponType)enumValue;
     }
     if (!BinaryCodec.Decode(decoder, out _physicalDamage))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _elementalDamage))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _physicalCritChance))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _elementalCritChance))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _physicalRate))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _elementalRate))
     {
         return(false);
     }
     if (!BinaryCodec.Decode(decoder, out _option))
     {
         return(false);
     }
     return(true);
 }
Example #4
0
    public void Reset()
    {
        m_ActiveActions.Clear();

        //  Stop = false;
        MotionType     = E_MotionType.None;
        WeaponState    = E_WeaponState.NotInHands;
        WeaponToSelect = E_WeaponType.None;

        Speed = 0;

        Health = MaxHealth;

        Rage      = RageMin;
        Dodge     = DodgeMin;
        Fear      = FearMin;
        IdleTimer = 0;

        MoveDir = Vector3.zero;

        DesiredPosition  = Vector3.zero;
        DesiredDirection = Vector3.zero;

        InteractionObject = null;
        Interaction       = E_InteractionType.None;

        DesiredAnimation = "";

        DesiredTarget     = null;
        DesiredAttackType = E_AttackType.None;

        DontUpdate = false;
    }
Example #5
0
 public override string GetDeathAnim(E_WeaponType weapon, E_DamageType type)
 {
     if (orochiUnlock)
     {
         Achievements.UnlockAchievement(14);
     }
     return("death");
 }
Example #6
0
    public override string GetDeathAnim(E_WeaponType weapon, E_DamageType type)
    {
        // string[] anims = { "death01", "death02"};

        return("death");

        //  return anims[Random.Range(0, 100) % anims.Length];
    }
Example #7
0
    public override string GetDeathAnim(E_WeaponType weapon, E_DamageType type)
    {
        if (type == E_DamageType.Back)
        {
            return("deathBack");
        }

        return("deathFront");
    }
Example #8
0
    public override string GetInjuryAnim(E_WeaponType weapon, E_DamageType type)
    {
        if (type == E_DamageType.Back)
        {
            return("injuryBackSword");
        }

        return("injuryFrontSword");
    }
Example #9
0
    public override AnimAttackData GetFirstAttackAnim(E_WeaponType weapon, E_AttackType attackType)
    {
        if (attackType == E_AttackType.Fatality)
        {
            return(AttackKnockdown);
        }

        return(null);
    }
    public override string GetIdleAnim(E_WeaponType weapon, E_WeaponState weaponState)
    {
        if (weaponState == E_WeaponState.NotInHands)
        {
            return("idle");
        }

        return("idleSword");
    }
    public override string GetIdleActionAnim(E_WeaponType weapon, E_WeaponState weaponState)
    {
        if (weapon == E_WeaponType.Katana)
        {
            return("idleTaunt");
        }

        return("idle");
    }
Example #12
0
    public void DoDamageFatality(Agent attacker, Agent mainTarget, E_WeaponType byWeapon, AnimAttackData data)
    {
        if (mainTarget.IsAlive == false || mainTarget.enabled == false)
        {
            return;
        }

        mainTarget.ReceiveDamage(attacker, byWeapon, 1000, data);
    }
Example #13
0
    public override AnimAttackData GetFirstAttackAnim(E_WeaponType weapom, E_AttackType attackType)
    {
        if (attackType == E_AttackType.Counter)
        {
            return(AnimAttacksSwordCounter);
        }

        return(AnimAttacksSwordL);
    }
    public override AnimAttackData GetFirstAttackAnim(E_WeaponType weapom, E_AttackType attackType)
    {
        if (attackType == E_AttackType.X)
        {
            return(AnimAttacksSword1);
        }


        return(AnimAttacksSword2);
    }
Example #15
0
 public override string GetWeaponAnim(E_WeaponType weapon, bool isShow)
 {
     if (isShow)
     {
         return("showSwordRun");
     }
     else
     {
         return("hidSwordRun");
     }
 }
Example #16
0
    public override string GetInjuryAnim(E_WeaponType weapon, E_DamageType type)
    {
        return("injury");

/*        if(type == E_DamageType.Back)
 *          return "injuryBack";
 *
 *      string[] anims = { "injuryFront01", "injuryFront02", "injuryFront03", "injuryFront04" };
 *
 *      return anims[Random.Range(0, anims.Length)];*/
    }
Example #17
0
    public override string GetIdleActionAnim(E_WeaponType weapon, E_WeaponState weaponState)
    {
        Debug.LogError("unssupported !!");

        if (weapon == E_WeaponType.Katana)
        {
            return("idleTount");
        }

        return("idle");
    }
    public override string GetInjuryAnim(E_WeaponType weapon, E_DamageType type)
    {
        if (type == E_DamageType.Back)
        {
            return("injuryBack");
        }

        string[] anims = { "injury01", "injury02", "injury03" };

        return(anims[Random.Range(0, anims.Length)]);
    }
Example #19
0
    public override string GetInjuryAnim(E_WeaponType weapon, E_DamageType type)
    {
        string[] anims =
        {
            "injuryFront01",
            "injuryFront02",
            "injuryFront03",
            "injuryFront04"
        };

        return(anims [UnityEngine.Random.Range(0, anims.Length)]);
    }
Example #20
0
    public void DoMeleeDamage(Agent attacker, Agent mainTarget, E_WeaponType byWeapon, AnimAttackData data, bool critical, bool knockdown)
    {
        if (attacker == Player.Instance.Agent)
        {
            StartCoroutine(EnemiesRecvDamage(attacker, mainTarget, byWeapon, data, critical, knockdown));
        }
        else
        {
            bool    hit = false;
            Vector3 dirToEnemy;
            Vector3 attackerDir = attacker.Forward;

            if (mainTarget == null)
            {
                mainTarget = Player.Instance.Agent;
            }

            if (mainTarget.IsInvulnerable == false && mainTarget.BlackBoard.MotionType != E_MotionType.Roll)
            {
                dirToEnemy = mainTarget.Position - attacker.Position;

                float len = dirToEnemy.sqrMagnitude;

                if (len < attacker.BlackBoard.sqrWeaponRange)
                {
                    dirToEnemy.Normalize();

                    if (len < 0.5f * 0.5f || data.HitAngle == -1 || Vector3.Angle(attackerDir, dirToEnemy) < data.HitAngle)
                    {
                        if (Game.Instance.GameDifficulty == E_GameDifficulty.Hard)
                        {
                            mainTarget.ReceiveDamage(attacker, byWeapon, data.HitDamage * 1.2f, data);
                        }
                        else
                        {
                            mainTarget.ReceiveDamage(attacker, byWeapon, data.HitDamage, data);
                        }
                        hit = true;
                    }
                }
            }

            if (hit)
            {
                attacker.Sound.PlayAttackHit();
            }
            else
            {
                attacker.Sound.PlayAttackMiss();
            }
        }
    }
Example #21
0
 public override string GetMoveAnim(E_MotionType motion, E_MoveType move, E_WeaponType weapon, E_WeaponState weaponState)
 {
     if (E_WeaponState.NotInHands == weaponState)
     {
         if (E_MotionType.Walk == motion)
         {
             return("walk");
         }
         return("run");
     }
     if (E_MotionType.Walk == motion)
     {
         return("walkSword");
     }
     return("runSword");
 }
Example #22
0
    public override AnimAttackData GetFirstAttackAnim(E_WeaponType weapom, E_AttackType attackType)
    {
        if (attackType == E_AttackType.X)
        {
            return(AnimAttacksSwordL);
        }
        else if (attackType == E_AttackType.Fatality)
        {
            return(AnimAttacksAfterknockdown);
        }
        else if (attackType == E_AttackType.BossBash)
        {
            return(AnimAttacksBash);
        }

        return(AnimAttacksSwordS);
    }
Example #23
0
    public override string GetKnockdowAnim(E_KnockdownState state, E_WeaponType weapon)
    {
        switch (state)
        {
        case E_KnockdownState.Down:
            return("knockdown");

        case E_KnockdownState.Loop:
            return("knockdownLoop");

        case E_KnockdownState.Up:
            return("knockdownUp");

        default:
            return(null);
        }
    }
Example #24
0
    public override AnimAttackData GetFirstAttackAnim(E_WeaponType weapon, E_AttackType attackType)
    {
        if (attackType == E_AttackType.X)
        {
            return(AnimAttackX);
        }
        else if (attackType == E_AttackType.O)
        {
            return(AnimAttackInjury);
        }
        else if (attackType == E_AttackType.Berserk)
        {
            return(AnimAttackBerserk);
        }

        return(null);
    }
Example #25
0
    public void ReceiveBlockedHit(Agent attacker, E_WeaponType byWeapon, float damage, AnimAttackData data)
    {
        BlackBoard.Attacker       = attacker;
        BlackBoard.AttackerWeapon = byWeapon;

        //if (debugGOAP == true) Debug.Log(Time.timeSinceLevelLoad + " Recieve blocked damage " + name.ToString() + " from " + attacker.name);

        WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.HitBlocked);

        bool fromBehind = Vector3.Dot(attacker.Forward, Forward) > -0.1f;

        if (fromBehind) // utok zezadu,kdyz koren blokuje
        {
            BlackBoard.Health     = Mathf.Max(1, BlackBoard.Health - damage);
            BlackBoard.DamageType = E_DamageType.BreakBlock;
            CombatEffectsManager.Instance.PlayBloodEffect(Transform.position, -attacker.Forward);
            SpriteEffectsManager.Instance.CreateBlood(Transform);
        }
        else
        { // blocked attack
            if (data.BreakBlock)
            {
                BlackBoard.DamageType = E_DamageType.BreakBlock;
                if (attacker.IsPlayer)
                {
                    Game.Instance.NumberOfBreakBlocks++;
                }

                CombatEffectsManager.Instance.PlayBlockBreakEffect(Transform.position, -attacker.Forward);
            }
            else
            {
                BlackBoard.DamageType = E_DamageType.Front;
                if (attacker.IsPlayer)
                {
                    Game.Instance.NumberOfBlockedHits++;
                }

                CombatEffectsManager.Instance.PlayBlockHitEffect(ChestPosition, -attacker.Forward);
            }
        }
    }
Example #26
0
    public override string GetMoveAnim(E_MotionType motion, E_MoveType move, E_WeaponType weapon, E_WeaponState weaponState)
    {
        if (weaponState == E_WeaponState.NotInHands)
        {
            if (motion != E_MotionType.Walk)
            {
                return("run");
            }
            else
            {
                return("walk");
            }
        }

        if (motion != E_MotionType.Walk)
        {
            return("runSword");
        }

        return("walkSword");
    }
Example #27
0
    /// <summary>
    /// Receives the blocked hit.
    /// 格挡
    /// </summary>
    /// <param name="attacker">Attacker.</param>
    /// <param name="byWeapon">By weapon.</param>
    /// <param name="damage">Damage.</param>
    /// <param name="data">Data.</param>
    public void ReceiveBlockedHit(Agent attacker, E_WeaponType byWeapon, float damage, AnimAttackData data)
    {
        BlackBoard.Attacker       = attacker;
        BlackBoard.AttackerWeapon = byWeapon;

        WorldState.SetWSProperty(E_PropKey.E_EVENT, E_EventTypes.HitBlocked);

        bool fromBehind = Vector3.Dot(attacker.Forward, Forward) > -0.1f;

        if (fromBehind)
        {
            BlackBoard.Health     = Mathf.Max(1, BlackBoard.Health - damage);
            BlackBoard.DamageType = E_DamageType.BreakBlock;
            CombatEffectsManager.Instance.PlayBloodEffect(Transform.position, -attacker.Forward);
            SpriteEffectsManager.Instance.CreateBlood(Transform);
        }
        else
        {
            if (data.BreakBlock)
            {
                if (attacker.IsPlayer)
                {
                    Game.Instance.NumberOfBreakBlocks++;
                }
                BlackBoard.DamageType = E_DamageType.BreakBlock;
                CombatEffectsManager.Instance.PlayBlockBreakEffect(Transform.position, -attacker.Forward);
            }
            else
            {
                if (attacker.IsPlayer)
                {
                    Game.Instance.NumberOfBlockedHits++;
                }
                BlackBoard.DamageType = E_DamageType.Front;
                CombatEffectsManager.Instance.PlayBlockHitEffect(ChestPosition, -attacker.Forward);
            }
        }
    }
Example #28
0
 public override string GetBlockAnim(E_BlockState state, E_WeaponType weapon)
 {
     if (state == E_BlockState.Start)
     {
         return("blockStart");
     }
     else if (state == E_BlockState.Loop)
     {
         return("blockLoop");
     }
     else if (state == E_BlockState.Failed)
     {
         return("blockFailed");
     }
     else if (state == E_BlockState.HitBlocked)
     {
         return("blockHit");
     }
     else
     {
         return("blockEnd");
     }
 }
Example #29
0
 public override string GetIdleAnim(E_WeaponType weapon, E_WeaponState weaponState)
 {
     throw new NotImplementedException();
 }
Example #30
0
 public override string GetDeathAnim(E_WeaponType weapon, E_DamageType type)
 {
     throw new NotImplementedException();
 }