Beispiel #1
0
 public PlayerAttackStats()
 {
     ComboAttacks = new PlayerAttackStats[0];
     Name         = "New Attack";
     attackInput  = AttackInputType.Light;
     impulses     = new Impulse[0];
 }
Beispiel #2
0
 public FiredAttackParticle(GameObject ps, CharacterNameType charaterId, AttackParticlePhaseTypes particleType, SideType side, AttackInputType attackInput)
 {
     PS           = ps;
     CharaterId   = charaterId;
     ParticleType = particleType;
     Side         = side;
     AttackInput  = attackInput;
 }
Beispiel #3
0
 PlayerAttack GetAttackFromDictionary(AttackInputType attackType)
 {
     if (attackDictionary.Keys.Contains(attackType))
     {
         return(attackDictionary[attackType]);
     }
     return(null);
 }
Beispiel #4
0
 public void StartChargingAtk(AttackInputType atkType)
 {
     /*  if (charging_Co != null)
      * {
      *    StopCoroutine(charging_Co);
      * }
      *
      * charging_Co = StartChargingAttack(atkType);
      * StartCoroutine(charging_Co);*/
     StartCoroutine(StartChargingAttack(atkType));
 }
Beispiel #5
0
    public PlayerAttack GetAttack(AttackInputType attackInputType)
    {
        PlayerAttack oldAttack = currentAttack;

        // Attack in progress already
        if (currentAttack != null){
            //  Has it been long enough for another attack
            if(currentAttack.PassedBaseAttackTime()){
                var attack = GetAttackFromDictionary(attackInputType);

                // No move next on the tree, start from base corresponding to button pressed
                if (attack == null){
                    if (baseAttacks.Keys.Contains(attackInputType)){
                        currentAttack = baseAttacks[attackInputType];
                    }
                }
                // Advance along the tree
                else{
                    currentAttack = attack;
                }

                if (logMessages){
                    Debug.Log(currentAttack.name);
                }
            }
            else {
                if (logMessages){
                    Debug.Log("No valid attack");
            }
                currentAttack = null;
            }
        }
        // Base attack on tree
        else{
            if (baseAttacks.Keys.Contains(attackInputType)){
                currentAttack = baseAttacks[attackInputType];
            }
        }

        if (currentAttack != null){
            currentAttack.StartTime = Time.time;
        }

        if ((oldAttack == attack1 || oldAttack == attack2) || (oldAttack != currentAttack && currentAttack != null)){
            if (behaviourCoroutine.IsPaused || behaviourCoroutine.IsRunning){
                behaviourCoroutine.Stop();
            }
        }

        return currentAttack;
    }
Beispiel #6
0
    public IEnumerator StartChargingAttack(AttackInputType nextAtkType)
    {
        if (CharInfo.StaminaStats.Stamina - CharInfo.PowerfulAttac.Stamina_Cost_Atk >= 0 &&
            CanAttack && !isSpecialLoading)
        {
            ScriptableObjectAttackBase nxtAtk = CharInfo.CurrentAttackTypeInfo.Where(r => r.AttackInput == nextAtkType).First();
            GameObject ps = null;
            isSpecialLoading    = true;
            chargingAttackTimer = 0;
            currentAttackPhase  = AttackPhasesType.Start;
            SetAnimation(nxtAtk.PrefixAnim + "_IdleToAtk", false, 0);

            while (isSpecialLoading && !VFXTestMode)
            {
                yield return(BattleManagerScript.Instance.PauseUntil());

                chargingAttackTimer += Time.fixedDeltaTime;

                if (SpineAnim.CurrentAnim == CharacterAnimationStateType.Idle.ToString())
                {
                    SetAnimation(nxtAtk.PrefixAnim + "_IdleToAtk");
                }
                if (!isChargingParticlesOn || ps == null)
                {
                    isChargingParticlesOn = true;
                    //Check
                    ps = ParticleManagerScript.Instance.FireParticlesInPosition(nxtAtk.Particles.CastLoopPS, CharInfo.CharacterID, AttackParticlePhaseTypes.Charging, transform.position, UMS.Side, nxtAtk.AttackInput);
                    ps.transform.parent = transform;
                }
                else
                {
                    SetParticlesLayer(ps);
                }


                if (!IsOnField)
                {
                    if (ps != null)
                    {
                        ps.transform.parent = null;
                        ps.SetActive(false);
                    }

                    yield break;
                }
            }
            if (chargingAttackTimer > 1f && CharInfo.Health > 0f)
            {
                currentAttackPhase = AttackPhasesType.Loading;
                StopPowerfulAtk    = SpecialAttackStatus.Start;
                if (IsOnField || VFXTestMode)
                {
                    while (isMoving)
                    {
                        yield return(new WaitForEndOfFrame());

                        if (StopPowerfulAtk == SpecialAttackStatus.Stop)
                        {
                            StopPowerfulAtk     = SpecialAttackStatus.None;
                            ps.transform.parent = null;
                            ps.SetActive(false);
                            yield break;
                        }
                    }
                    SpecialAttack(nxtAtk);
                }
            }
            else
            {
                SetAnimation(CharacterAnimationStateType.Idle, true, 0.1f);
            }
            ps.transform.parent = null;
            ps.SetActive(false);
        }
    }
Beispiel #7
0
    public PlayerAttack GetAttack(AttackInputType attackInputType)
    {
        PlayerAttack oldAttack = currentAttack;

        // Attack in progress already
        if (currentAttack != null)
        {
            //  Has it been long enough for another attack
            if (currentAttack.PassedBaseAttackTime())
            {
                var attack = GetAttackFromDictionary(attackInputType);

                // No move next on the tree, start from base corresponding to button pressed
                if (attack == null)
                {
                    if (baseAttacks.Keys.Contains(attackInputType))
                    {
                        currentAttack = baseAttacks[attackInputType];
                    }
                }
                // Advance along the tree
                else
                {
                    currentAttack = attack;
                }

                if (logMessages)
                {
                    Debug.Log(currentAttack.name);
                }
            }
            else
            {
                if (logMessages)
                {
                    Debug.Log("No valid attack");
                }
                currentAttack = null;
            }
        }
        // Base attack on tree
        else
        {
            if (baseAttacks.Keys.Contains(attackInputType))
            {
                currentAttack = baseAttacks[attackInputType];
            }
        }

        if (currentAttack != null)
        {
            currentAttack.StartTime = Time.time;
        }

        if ((oldAttack == attack1 || oldAttack == attack2) || (oldAttack != currentAttack && currentAttack != null))
        {
            if (behaviourCoroutine.IsPaused || behaviourCoroutine.IsRunning)
            {
                behaviourCoroutine.Stop();
            }
        }

        return(currentAttack);
    }
Beispiel #8
0
 PlayerAttack GetAttackFromDictionary(AttackInputType attackType)
 {
     if (attackDictionary.Keys.Contains(attackType)){
         return  attackDictionary[attackType];
     }
     return null;
 }
Beispiel #9
0
 public GameObject FireParticlesInTransform(GameObject ps, CharacterNameType characterId, AttackParticlePhaseTypes particleType, Transform parent, SideType side, AttackInputType attackInput, bool particlesVisible)
 {
     //pType = AttackParticleTypes.Test_Mesh;
     using (FiredAttackParticle psToFire = AttackParticlesFired.Where(r => r.ParticleType == particleType && r.CharaterId == characterId &&
                                                                      !r.PS.gameObject.activeInHierarchy && r.Side == side && r.AttackInput == attackInput).FirstOrDefault())
     {
         if (psToFire != null)
         {
             psToFire.PS.transform.parent        = parent;
             psToFire.PS.transform.localPosition = Vector3.zero;
             psToFire.PS.SetActive(particlesVisible);//particlesVisible
             return(psToFire.PS);
         }
         else
         {
             GameObject res = Instantiate(ps, parent.position, parent.rotation, parent);
             res.transform.localPosition = Vector3.zero;
             res.SetActive(particlesVisible);//particlesVisible
             AttackParticlesFired.Add(new FiredAttackParticle(res, characterId, particleType, side, attackInput));
             return(res);
         }
     }
 }
Beispiel #10
0
 public GameObject FireParticlesInPosition(GameObject ps, CharacterNameType characterId, AttackParticlePhaseTypes particleType, Vector3 pos, SideType side, AttackInputType attackInput)
 {
     using (FiredAttackParticle psToFire = AttackParticlesFired.Where(r => r.ParticleType == particleType && r.CharaterId == characterId &&
                                                                      !r.PS.gameObject.activeInHierarchy && r.Side == side && r.AttackInput == attackInput).FirstOrDefault())
     {
         if (psToFire != null)
         {
             psToFire.PS.transform.position = pos;
             psToFire.PS.SetActive(true);
             return(psToFire.PS);
         }
         else
         {
             GameObject res = Instantiate(ps, pos, Quaternion.identity, Container);
             res.SetActive(true);
             AttackParticlesFired.Add(new FiredAttackParticle(res, characterId, particleType, side, attackInput));
             return(res);
         }
     }
 }
Beispiel #11
0
 public void SelectedCharacterStartChargingAttack(int player, AttackInputType atk)
 {
     BattleManagerScript.Instance.StartChargingAttack((ControllerType)player, atk);
 }