Esempio n. 1
0
    public virtual IEnumerator Shoot(int behaviourIndex)
    {
        WeaponBehaviour behaviour = weaponBehaviours[behaviourIndex];

        behaviour.canNotAttack = true;
        float attackSpeed = 1 / behaviour.attacksPerSecond;

        if (behaviour.currentAo == behaviour.attackOrigins.Length - 1)
        {
            behaviour.currentAo = 0;
        }
        else
        {
            behaviour.currentAo++;
        }

        AttackOrigin origin = behaviour.attackOrigins[behaviour.currentAo];

        wBehaviour = behaviour;

        InteractableActions.single_IA.PlayFireArmsEffect(index, behaviourIndex, behaviour.currentAo, "Shoot");
        ShootBehaviour(origin.origin, behaviour.bulletSpread, behaviour.impactEffect);

        origin.animator.speed = behaviour.attacksPerSecond;
        origin.animator.SetTrigger("Shoot");
        yield return(new WaitForSeconds(attackSpeed));

        behaviour.canNotAttack = false;
    }
Esempio n. 2
0
 private void Awake()
 {
     if (attackPatternsByWave.Select(inner => inner.attackPatterns.Count).Aggregate((a, b) => a + b) == 0)
     {
         StopAndThrowInitializationError("Field attackPatternsByWave was not initialized");
     }
     GetComponent <IHealthSystem>().OnWaveDeath += HandleEnemyWaveDeath;
     _attackOrigin = GetComponent <AttackOrigin>();
 }
    void RPC_PlayFireArmEffects(int index, int behaviourIndex, int aoIndex, string triggerName)
    {
        FireArms        ia        = InteractablesList.single_IaList.interactables[index] as FireArms;
        WeaponBehaviour behaviour = ia.weaponBehaviours[behaviourIndex];
        AttackOrigin    origin    = behaviour.attackOrigins[aoIndex];

        origin.animator.speed = behaviour.attacksPerSecond;
        origin.animator.SetTrigger(triggerName);
    }