Ejemplo n.º 1
0
 //this starts the animation for melee
 public override void Attack()
 {
     enemyInfo.isRangedAttacking = false;
     enemyInfo.isMeleeAttacking  = true;
     Robot01JetAnim.SetFloat(parameterSpeedHash, 0);
     EnemyAnim.SetTrigger(parameterMeleeHash);
 }
Ejemplo n.º 2
0
 public override void Shoot()
 {
     EnemyAnim.SetFloat(parameterSpeedHash, 0);
     enemyInfo.isMeleeAttacking  = false;
     enemyInfo.isRangedAttacking = true;
     EnemyAnim.SetTrigger(parameterRangedHash);
 }
Ejemplo n.º 3
0
 protected override void OnCollisionEnter2D(Collision2D collision)
 {
     base.OnCollisionEnter2D(collision);
     if (collision.gameObject.tag == "Player")
     {
         Die();
         EnemyAnim.SetTrigger(parameterDieHash);
     }
 }
Ejemplo n.º 4
0
 public void Summon()
 {
     Instantiate(summonPool[0], summonSpawn.position, summonSpawn.rotation);
     stateInfo.summonCounter--;
     if (stateInfo.summonCounter <= 0)
     {
         EnemyAnim.SetTrigger(parameterEndSummongHash);
         PickNextAttackState();
     }
 }
Ejemplo n.º 5
0
 public override void Attack()
 {
     if (enemyMovementInfo.isGrounded)
     {
         EnemyAnim.SetFloat(parameterSpeedHash, 0);
         enemyInfo.isRangedAttacking = false;
         enemyInfo.isMeleeAttacking  = true;
         EnemyAnim.SetTrigger(parameterMeleeHash);
         CalculateAndApplyJump();
     }
 }
Ejemplo n.º 6
0
    public IEnumerator ChargeShot()
    {
        float chargeTime = 0f;

        while (chargeTime < bossStats.normalMeleeChargingTime)
        {
            chargeTime += .5f;
            yield return(new WaitForSeconds(.5f));
        }
        EnemyAnim.SetTrigger(parameterLaunchMeleeHash);
    }
Ejemplo n.º 7
0
 public override void TakeDamage(float damageTaken)
 {
     enemyStats.currentHealth -= damageTaken;
     if (!IsDead)
     {
     }
     else
     {
         Die();
         EnemyAnim.SetTrigger(parameterDieHash);
     }
 }
Ejemplo n.º 8
0
 public override void LookAtTarget()
 {
     if (target != null)
     {
         Transform targetTransform = target.GetComponent <Transform>();
         float     targetDirection = targetTransform.position.x - EnemyTransform.position.x;
         if (targetDirection < 0 && roboRamMovementInfo.FacingDirection == 1 || targetDirection > 0 && roboRamMovementInfo.FacingDirection == -1)
         {
             roboRamMovementInfo.FacingDirection *= -1;
         }
         EnemyTransform.localScale = new Vector3(Mathf.Abs(EnemyTransform.localScale.x) * roboRamMovementInfo.FacingDirection, EnemyTransform.localScale.y, EnemyTransform.localScale.z);
         EnemyAnim.SetTrigger(parameterTurnHash);
     }
 }
Ejemplo n.º 9
0
 public override void TakeDamage(float damageTaken)
 {
     roboRamStats.currentHealth -= damageTaken;
     enemyStats.currentHealth    = roboRamStats.currentHealth;
     if (!IsDead)
     {
     }
     else
     {
         PlaySoundOnceOnManager(AudioParams.SoundPoolGroups.ROBORAM, AudioParams.SoundPools.DUYING);
         Die();
         EnemyAnim.SetTrigger(parameterDieHash);
     }
 }
Ejemplo n.º 10
0
 public void HandleAnimation(int parameterHash)
 {
     if (animationDictionary != null && animationDictionary.ContainsKey(parameterHash))
     {
         if (!EnemyAnim.GetCurrentAnimatorStateInfo(0).IsName(animationDictionary[parameterHash]))
         {
             EnemyAnim.SetTrigger(parameterHash);
         }
     }
     else
     {
         Debug.LogError("An Animation with hash (" + parameterHash + ") has been called while it doesn't exist in \"" + this.name + "\" => \"animationDictionnary\" [State :" + currentAIState.name + "]");
     }
 }
Ejemplo n.º 11
0
    public IEnumerator ShootAndWait()
    {
        int i = 1;

        for (i = 1; i <= bossStats.numberOfNormalShots; i++)
        {
            ShootProjectile();
            yield return(new WaitForSeconds(bossStats.rangedCD));
        }

        //not optimal shouldn't be here but i was stuck couldn't find a solution
        if (i > bossStats.numberOfNormalShots)
        {
            EnemyAnim.SetTrigger(parameterIdleHash);
            PickNextAttackState();
        }
    }
Ejemplo n.º 12
0
 public override void TakeDamage(float damageTaken)
 {
     enemyStats.currentHealth -= damageTaken;
     if (!IsDead)
     {
         if (enemyStats.currentHealth < stateInfo.nextHealthMilestone)
         {
             PlaySound(AudioParams.SoundPoolGroups.ROBEAR, AudioParams.SoundPools.FATIGUE);
             if (coroutine != null)
             {
                 StopCoroutine(coroutine);
             }
             //Default values
             stateInfo.startedMeleeAttacking  = false;
             stateInfo.startedRangedAttacking = false;
             stateInfo.isInCycle         = false;
             enemyInfo.isRangedAttacking = false;
             enemyInfo.isMeleeAttacking  = false;
             stateInfo.isSummoning       = false;
             //EnemyAnim.SetTrigger(parameterEndSummongHash);
             if (stateInfo.currentMeleeShot != null)
             {
                 Destroy(stateInfo.currentMeleeShot);
                 stateInfo.currentMeleeShot = null;
             }
             ChangeState(new RoBearIdleState());
             stateInfo.nextHealthMilestone = stateInfo.nextHealthMilestone - ((stateInfo.milestonePercentage * enemyStats.baseHealth) / 100);
             bossStats.rageLevel          += 1;
             bossStats.Enrage(bossStats.rageLevel);
             EnemyAnim.SetTrigger(parameterHurtHash);
         }
     }
     else
     {
         stateInfo.isDying = true;
         PlaySoundOnceOnManager(AudioParams.SoundPoolGroups.ROBEAR, AudioParams.SoundPools.DUYING);
         Die();
         EnemyAnim.SetTrigger(parameterDieHash);
     }
 }