Exemple #1
0
 //------------------------------------------------------------------------------------------
 // 破裂エフェクトの生成
 //------------------------------------------------------------------------------------------
 private void GenerateBurstEffect()
 {
     EffectGenerator.BubbleBurstFX(
         new BubbleBurstFX.Param(GetComponent <SpriteRenderer>().color, transform.localScale),
         transform.localPosition,
         null);
 }
Exemple #2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.transform.tag == "Player" && !burst)
     {
         SoundPlayer.Play(burstSE);
         Vector2 effectSize = Vector2.one * 1.5f;
         EffectGenerator.BubbleBurstFX(
             new BubbleBurstFX.Param(this.GetComponent <SpriteRenderer>().color, effectSize),
             transform.position,
             null);
         burst = true;
         GameObject.Find(Common.Camera.MAIN_CAMERA).GetComponent <CameraShake>().Shake(0.1f, 1.0f);
     }
     if (collision.transform.tag == "Bullet" && !burst)
     {
         SoundPlayer.Play(burstSE, 0.7f);
         Vector2 effectSize = Vector2.one * 3.5f;
         EffectGenerator.BubbleBurstFX(
             new BubbleBurstFX.Param(this.GetComponent <SpriteRenderer>().color, effectSize),
             transform.position,
             null);
         burst = true;
         GameObject.Find(Common.Camera.MAIN_CAMERA).GetComponent <CameraShake>().Shake(0.1f, 1.0f);
     }
 }
 //------------------------------------------------------------------------------------------
 // 破裂エフェクトの生成
 //------------------------------------------------------------------------------------------
 private void GenerateBurstEffect()
 {
     EffectGenerator.BubbleBurstFX(
         new BubbleBurstFX.Param(Color.white, renderObject.transform.lossyScale),
         transform.position,
         null);
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "CollectObject")
        {
            // リスポーン位置を設定
            Data.initialPlayerPos = collision.gameObject.transform.position;
        }

        if (collision.tag == Stage.GROUND || collision.tag == Bubble.GROUND || collision.tag == Common.Floor.NAME || collision.tag == "DamageTile")
        {
            isGround   = true;
            jumpCount  = 0;
            boostCount = 2;

            // 着地エフェクト(保留)
            if (!IsDead())
            {
                Vector2 effectSize = Vector2.one * 0.7f;
                EffectGenerator.BubbleBurstFX(
                    new BubbleBurstFX.Param(this.GetComponent <SpriteRenderer>().color, effectSize, 160, 4),
                    new Vector2(this.transform.position.x, this.transform.position.y - 1.0f),
                    null);
            }
        }

        // バブルキャノン(仮)
        if (collision.gameObject.tag == "BubbleCannon")
        {
            collision.gameObject.transform.parent.gameObject.GetComponent <BubbleCannon>().HitToPlayer();
            rig.velocity = rig.velocity * 0.0f;
            float sticV = Input.GetAxis(Player.VERTICAL);
            Mathf.Abs(sticV); // 入力の度合

            if (Input.GetAxis(Player.VERTICAL) <= 0.0f && sticV >= 0.1f)
            {
                rig.AddForce(new Vector2(boostForce.x * 1.3f * Input.GetAxis(Player.HORIZONTAL), boostForce.y * 1.3f * Input.GetAxis(Player.VERTICAL)), ForceMode2D.Impulse);
            }
            else
            {
                rig.AddForce(new Vector2(boostForce.x * 1.3f * Input.GetAxis(Player.HORIZONTAL), (boostForce.y * 1.3f * Input.GetAxis(Player.VERTICAL)) + 10.0f), ForceMode2D.Impulse);
            }
            // ブースト回数の回復
            boostCount = 2;
        }

        // バブルチャージ
        if (collision.gameObject.tag == "BubbleCharge")
        {
            Boost(Vector3.zero);
        }

        // 汚れ
        if (collision.gameObject.tag == "Dirt")
        {
            dirtManager.EnterDirt(collision.gameObject);
        }
    }
Exemple #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == Player.NAME && !atOnce)
     {
         atOnce = true;
         // バブルを生成(複数個)
         bubbleG.BubbleCreate(this.transform.position, num_bubble, false);
         Destroy(this.gameObject);
         Vector2 effectSize = Vector2.one * 1.5f;
         EffectGenerator.BubbleBurstFX(new BubbleBurstFX.Param(Color.white, effectSize), transform.position, null);
     }
 }
Exemple #6
0
    public void HitToPlayer()
    {
        currentStatus = Status.Dead;
        deadCount     = restorationCount;
        Vector2 effectSize = Vector2.one * 1.5f;

        EffectGenerator.BubbleBurstFX(
            new BubbleBurstFX.Param(Color.white, effectSize),
            transform.position,
            null);
        transform.GetChild(0).gameObject.SetActive(false);
    }
    //------------------------------------------------------------------------------------------
    // ブースト移動
    //------------------------------------------------------------------------------------------
    public bool UseBoost(float useSize, float effectSize)
    {
        if (!UseBalloon(useSize))
        {
            return(false);
        }

        EffectGenerator.BubbleBurstFX(
            new BubbleBurstFX.Param(Color.white, Vector2.one * effectSize),
            transform.position,
            null);

        return(true);
    }
    //------------------------------------------------------------------------------------------
    // 死亡時処理
    //------------------------------------------------------------------------------------------
    private void DeathUpdate()
    {
        if (!playerIsDead)
        {
            if (Data.time <= 0)
            {
                return;
            }

            deathAnimationState = DeathAnimationInfo.DeathAnimatonState.Death;
            playerIsDead        = true;
            deathAnimationTimer = 0;
            deathAnimationInfo.bubble.SetActive(false);
            animator.SetInteger("DeathState", 1);
        }

        deathAnimationTimer += Time.deltaTime;
        switch (deathAnimationState)
        {
        case DeathAnimationInfo.DeathAnimatonState.Death:
            if (deathAnimationTimer >= deathAnimationInfo.deathAnimationTime)
            {
                deathAnimationState = DeathAnimationInfo.DeathAnimatonState.Appear;
                deathAnimationTimer = 0;
                deathAnimationInfo.bubble.SetActive(true);
                deathAnimationInfo.bubble.transform.localScale = new Vector3(0, 0, 1);
            }
            break;

        case DeathAnimationInfo.DeathAnimatonState.Appear:
            float t2 = Mathf.Min(deathAnimationTimer / deathAnimationInfo.bubbleAppearTime, 1);
            t2 *= 2;
            deathAnimationInfo.bubble.transform.localScale = new Vector3(3 * t2, 3 * t2, 1);
            if (deathAnimationTimer >= deathAnimationInfo.bubbleAppearTime)
            {
                deathAnimationState = DeathAnimationInfo.DeathAnimatonState.Move;
                deathAnimationTimer = 0;
                deathPos            = player.transform.position;
            }
            break;

        case DeathAnimationInfo.DeathAnimatonState.Move:
            float t3 = Mathf.Min(deathAnimationTimer / deathAnimationInfo.bubbleMoveTime, 1);
            t3 = t3 * (2 - t3);
            player.transform.position = Vector3.Lerp(deathPos, Data.initialPlayerPos + Vector3.up * 0.1f, t3);
            if (deathAnimationTimer >= deathAnimationInfo.bubbleMoveTime)
            {
                deathAnimationState = DeathAnimationInfo.DeathAnimatonState.Burst;
                deathAnimationTimer = 0;
                deathAnimationInfo.bubble.SetActive(false);
                player.GetComponent <Rigidbody2D>().velocity *= 0.0f;
                EffectGenerator.BubbleBurstFX(new BubbleBurstFX.Param(Color.white, Vector2.one * 3), Data.initialPlayerPos + Vector3.up * 0.1f);
            }
            break;

        case DeathAnimationInfo.DeathAnimatonState.Burst:
            if (deathAnimationTimer >= deathAnimationInfo.bubbleBurstTime)
            {
                deathAnimationState = DeathAnimationInfo.DeathAnimatonState.Repair;
                animator.SetInteger("DeathState", 2);
                deathAnimationTimer = 0;
            }
            break;

        case DeathAnimationInfo.DeathAnimatonState.Repair:
            if (deathAnimationTimer >= deathAnimationInfo.repairAnimationTime)
            {
                playerIsDead = false;
                if (Data.time > 0)
                {
                    player.Repair();
                }
                animator.SetInteger("DeathState", 0);
            }
            break;

        default:
            break;
        }
    }