예제 #1
0
    void CalcIndex()
    {
        float perc = MathSET.Map(currentHp, 0, maxHp, 0, 1);

        if (perc > 0.75f)
        {
            rageIndex = 0;
        }
        else if (perc > 0.5f)
        {
            rageIndex = 1;
        }
        else if (perc > 0.25f)
        {
            rageIndex = 2;
        }
        else if (perc > 0.05f)
        {
            rageIndex = 3;
        }
        else
        {
            rageIndex = 4;
        }
    }
예제 #2
0
    void CalcStars()
    {
        angleOffset = (angleOffset + STAR_OMEGAS[rageIndex] * Time.deltaTime) % 360f;

        for (int i = 0; i < stars.Count; ++i)
        {
            float angle = ((MathSET.Map(i, 0, stars.Count, 0f, 360f) + angleOffset) % 360f) * Mathf.Deg2Rad;
            stars[i].position = new Vector3(transform.position.x + STAR_DISTANCE * Mathf.Cos(angle), transform.position.y + STAR_DISTANCE * Mathf.Sin(angle), transform.position.z);
        }
    }
예제 #3
0
    void Shoot()
    {
        for (float i = 0; i < BULLET_COUNT[rageIndex]; ++i)
        {
            SoundManager.Play(audioSrc, SoundManager.Clip.BOSS_SHOOT);
            float angle = ((MathSET.Map(i, 0, BULLET_COUNT[rageIndex], 0f, 360f) + angleOffset) % 360f) * Mathf.Deg2Rad;

            Vector3 vel = new Vector3(BULLET_SPEEDS[rageIndex] * Mathf.Cos(angle), BULLET_SPEEDS[rageIndex] * Mathf.Sin(angle), 0f);

            ProjectileScript proj = Instantiate(bulletPrefab, transform.position, Quaternion.Euler(0f, 0f, angle * Mathf.Rad2Deg)).GetComponent <ProjectileScript>();
            proj.Construct(vel, BULLET_DAMAGE, "Bullet_pi", 255);
        }
    }
예제 #4
0
파일: Alive.cs 프로젝트: deprimus/D1
    protected virtual void RenderHp()
    {
        float scale = GetHpScale();

        hpEmptyTransform.localScale   = new Vector3(scale, scale, 1f);
        hpOverlayTransform.localScale = new Vector3(MathSET.Map(currentHp, 0f, maxHp, 0f, scale), scale, 1f);

        Vector3 pos   = GetTransform().position + (-GetTransform().up *HP_BAR_DISTANCE);
        Vector3 angle = GetTransform().eulerAngles;

        hpEmptyTransform.position   = pos;
        hpOverlayTransform.position = pos;

        hpEmptyTransform.eulerAngles   = angle;
        hpOverlayTransform.eulerAngles = angle;
    }
예제 #5
0
파일: PlayerScript.cs 프로젝트: deprimus/D1
    protected override void Die()
    {
        if (!dead)
        {
            dead = true;

            RenderHp();

            if (isAtBoss)
            {
                if (MathSET.Map(boss.currentHp, 0f, boss.maxHp, 0f, 1f) > 0.05f)
                {
                    SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
                }
                else
                {
                    dialogManager.ShowDialog(() =>
                    {
                        SoundManager.PlayWith(audioSrc, SoundManager.Clip.SIGSEGV, () =>
                        {
                            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
                        });
                    },
                                             new Tuple <string, string>("Pi", "Phew, that was close."),
                                             new Tuple <string, string>("David", "..."),
                                             new Tuple <string, string>("David", "I'm doomed."),
                                             new Tuple <string, string>("Pi", "You see, I'm actually immortal."),
                                             new Tuple <string, string>("Pi", "Even if you wanted to, you couldn't kill me."),
                                             new Tuple <string, string>("Pi", "Anyway, looks like you're kind of dead."),
                                             new Tuple <string, string>("Pi", "I'll take my leave. Goodbye."));
                }
            }
            else
            {
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
            }
        }
    }