Beispiel #1
0
    public static List <string> BuildWeaponPreloadAssets(int proto, int gender, int weaponID, int weaponItemID = -1, int offWeaponID = -1, int offWeaponItemID = -1, List <string> assets = null, bool player = false)
    {
        if (assets == null)
        {
            assets = new List <string>();
        }

        assets.Add(Creature.GetAnimatorName(weaponID, gender));    // Animator

        var w = WeaponInfo.GetWeapon(weaponID, weaponItemID);      // Main-hand weapon models

        w.GetAllAssets(assets);

        assets.Add(WeaponInfo.GetVictoryAnimation(weaponID, gender));

        if (offWeaponID > -1)
        {
            w = WeaponInfo.GetWeapon(offWeaponID, offWeaponItemID);   // Off-hand weapon models
            w.GetAllAssets(assets);
        }

        // Collect all weapon assets
        StateMachineInfo.GetAllAssets(weaponID, offWeaponID, assets, proto, gender, weaponItemID, offWeaponItemID, player);

        return(assets);
    }
Beispiel #2
0
    protected virtual bool PlayVictoryAnimation()
    {
        player.enableUpdate = true;
        if (player.pet)
        {
            player.pet.enableUpdate = true;
        }

        var vn = WeaponInfo.GetVictoryAnimation(player.weaponID, player.gender);

        if (string.IsNullOrEmpty(vn))
        {
            return(false);
        }

        var ww = GetPreloadObject <GameObject>(vn);

        if (!ww)
        {
            return(false);
        }

        var anim = ww.GetComponent <Animation>();

        if (!anim || !anim.clip)
        {
            return(false);
        }

        var camPos = ww.transform.childCount > 0 && ww.transform.GetChild(0).childCount > 0 ? ww.transform.GetChild(0).GetChild(0) : null;

        if (!camPos)
        {
            return(false);
        }

        m_player.direction = CreatureDirection.FORWARD;
        m_player.stateMachine.TranslateToID(StateMachineState.STATE_VICTORY);

        m_victoryTime = GetStateTimer(BattleStates.Winning) + (int)((anim.clip.length + CombatConfig.sendWindowDelay) * 1000);
        if (m_victoryTime < 0)
        {
            m_victoryTime = 0;
        }

        combatCamera.enabled = false;

        Util.AddChild(player.model, ww.transform, false);
        Util.AddChild(camPos, combatCamera.transform, Vector3.zero, Vector3.one, new Vector3(0, 180, 0));
        OnPlayLightVictoryAnimation(combatCamera.transform.localEulerAngles, m_victoryTime);

        OnPlayVictoryAnimation();

        return(true);
    }