예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            //ParticlesManager.SpawnParticle("tornado3D", spawnPosition.position, true);
            ParticlesManager.SpawnParticle("hitEffect", spawnPosition.position, true);
            //GameObject go = Instantiate(particlesPrefab, spawnPosition.position, Quaternion.identity);
            //go.GetComponent<TornadoBehaviour>().SetFacingRight(true);
        }

        //if (Input.GetKeyDown(KeyCode.RightControl))
        //{
        //    ParticlesManager.SpawnParticle("wildboar", spawnPosition.position, true);
        //}

        //if (Input.GetKeyDown(KeyCode.Space))
        //{
        //    ParticlesManager.SpawnElfFireBall(spawnPosition.position, target.transform.position - transform.position);
        //}

        //if (Input.GetKeyDown(KeyCode.Space))
        //{
        //    ParticlesManager.SpawnParticle("blood", spawnPosition.position, true);
        //}
    }
예제 #2
0
    public void ApplyDamage(int dmg = 0)
    {
        ParticlesManager.SpawnParticle("hitEffect", transform.position, true);
        GameObject broken = Instantiate(remains, transform.position, transform.rotation);

        broken.GetComponent <AdjustDirection>().fragmentScale = transform.localScale;
        broken.GetComponent <AdjustDirection>().pushForceX    = pushForceX;
        broken.GetComponent <AdjustDirection>().pushForceY    = pushForceY;

        AudioManager.instance.PlayDiegeticFx(gameObject, destructionSound, false, 1.0f, AudioManager.FX_DESTRUCTION_VOL);
        GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraFollow>().StartShake(magnitude, duration);
        Destroy(gameObject);
    }
예제 #3
0
 // when attacking the chest it gets open
 public void ApplyDamage(int dmg = 0)
 {
     ParticlesManager.SpawnParticle("hitEffect", transform.position, true);
     if (currentState == state.CLOSED)
     {
         if (openChest)
         {
             AudioManager.instance.PlayDiegeticFx(gameObject, openChest, false, 1.0f, AudioManager.FX_OPEN_CHEST_VOL);
         }
         currentState = state.OPEN;
         chestAnimator.SetBool("open", true);
     }
 }
예제 #4
0
    // ------------------------------------- ACTIONS TO PERFORM IN EACH STATE --------------------------------------------
    private void Damaged()
    {
        Vector3 ballSpawnPosition = transform.FindChild("BallSpawnPoint").transform.position;

        bossAnimator.Play("Damaged", bossAnimator.GetLayerIndex("Damaged"), 0);
        if (!bloodyDamage)
        {
            ParticlesManager.SpawnParticle("hitEffect", ballSpawnPosition, facingRight); //TODO: set position at the right place
        }
        else
        {
            ParticlesManager.SpawnParticle("blood", ballSpawnPosition, facingRight); //TODO: set position at the right place
            bloodyDamage = false;
        }
        damaged = false;
        AudioManager.instance.RandomizePlayFx(gameObject, 1.0f, AudioManager.FX_BOSS_BEING_HIT_VOL, beingHit);
    }
예제 #5
0
 public void ApplyDamage(int damage)
 {
     if (currentState != State.STUNNED)
     {
         animator.SetLayerWeight(1, 1.0f);
         Debug.Log(name.ToString() + ": I've been hit");
         if (enemyStats.hitPoints <= 0)
         {
             ChangeState(State.DEAD);
         }
         else
         {
             ChangeState(State.BEING_HIT);
         }
         // camera shake when starting being hit state
         camFollow.StartShake();
         if (!bloodyDamage)
         {
             GameObject hitEffect = ParticlesManager.SpawnParticle("hitEffect", transform.position, facingRight);                                                                                                                                        //blood.transform.parent = transform;
         }
         else
         {
             GameObject blood = ParticlesManager.SpawnParticle("blood", transform.position, facingRight);                                                                                                                                     //blood.transform.parent = transform;
             bloodyDamage = false;
         }
     }
     else
     {
         animator.SetLayerWeight(1, 1.0f);
         animator.Play("Damaged", animator.GetLayerIndex("Damaged"), 0);
         AudioManager.instance.RandomizePlayFx(gameObject, 1.0f, AudioManager.FX_DARKELF_HURT_SCREAM_VOL, hurtScream);
         // camera shake when starting being hit state
         camFollow.StartShake();
         if (!bloodyDamage)
         {
             GameObject hitEffect = ParticlesManager.SpawnParticle("hitEffect", transform.position, facingRight);                                                                                                                                      //blood.transform.parent = transform;
         }
         else
         {
             GameObject blood = ParticlesManager.SpawnParticle("blood", transform.position, facingRight);                                                                                                                                   //blood.transform.parent = transform;
             bloodyDamage = false;
         }
     }
 }
예제 #6
0
    private void PreBallAttack()
    {
        if (currAnimation != "PreBallAttack")
        {
            bossAnimator.SetBool(currAnimation, false);
            currAnimation = "PreBallAttack";
            bossAnimator.SetBool(currAnimation, true);

            fireAura.GetComponent <SphereCollider>().enabled = true;
            ballAttackIndicatorPS.Play();
            fireAuraPS.Play();
            fireAuraDamageScript.auraActive = true;

            Vector3    ballSpawnPosition = transform.FindChild("BallSpawnPoint").transform.position;
            GameObject fireBall          = ParticlesManager.SpawnParticle("bossFireBall", ballSpawnPosition, facingRight);
            fireBall.GetComponent <BossFireBallBehaviour>().SetFacingRight(facingRight);
            fireBall.GetComponent <BossFireBallBehaviour>().GenerateBall();

            fireballAuraSource = AudioManager.instance.PlayDiegeticFx(gameObject, fireballAura, true, 1.0f, AudioManager.FX_BOSS_FIREBALL_AURA_VOL);
        }
        preBallAttackFinished = true;

        //Set the boss looking at the player
        Vector3 newPos = gameObject.transform.position;
        int     diff   = (int)(thePlayer.transform.position.x - newPos.x);

        if (diff > 0)
        {
            if (!facingRight)
            {
                Flip();
            }
        }
        if (diff < 0)
        {
            if (facingRight)
            {
                Flip();
            }
        }
    }
예제 #7
0
    public override void HandleInput(PlayerInput input, PlayerStatus status)
    {
        if (status.previousState != this)
        {
            castFramesCount = 0;

            //if (status.magic == PlayerStatus.MAGIC.EAGLE)
            if (input.newInput.GetLeftTriggerInput() > 0)
            {
//                status.PlayFx("tornado");
                status.StartGUIFeedback("Tornado");
                // New version with ParticlesManager
                if (status.facingRight)
                {
                    ParticlesManager.SpawnParticle("tornado3D", status.transform.position + status.eagleAttackInstanceOffset, true);
                }
                else
                {
                    ParticlesManager.SpawnParticle("tornado3D", status.transform.position - status.eagleAttackInstanceOffset.x * Vector3.right + status.eagleAttackInstanceOffset.y * Vector3.up, false);
                }
            }

            //if (status.magic == PlayerStatus.MAGIC.WILDBOAR)
            if (input.newInput.GetRightTriggerInput() > 0)
            {
//                status.PlayFx("wildboar");
                status.StartGUIFeedback("Earthquake");
                if (status.facingRight)
                {
                    ParticlesManager.SpawnParticle("wildboar", status.transform.position + status.wildboarAttackInstanceOffset, true);
                }
                else
                {
                    ParticlesManager.SpawnParticle("wildboar", status.transform.position - status.wildboarAttackInstanceOffset.x * Vector3.right + status.wildboarAttackInstanceOffset.y * Vector3.up, false);
                }
            }

            /*
             * else
             * {
             *  status.SetState(PlayerStatus.idle);
             *  return;
             * }*/
        }

        if (castFramesCount >= castFramesDuration)
        {
            if (input.newInput.GetHorizontalInput() != 0)
            {
                status.SetState(PlayerStatus.walk);
            }
            else
            {
                status.SetState(PlayerStatus.idle);
            }
        }
        else
        {
            status.SetState(this);
        }

        castFramesCount++;
    }