예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Vector2.Distance(gameObject.transform.position, PlayerController.player.GetComponent <Transform>().position) < 2f)
        {
            timeint = Time.time - time;
            if (onCD == 1)
            {
                if (timeint > cd)
                {
                    onCD = 0;
                }
                damageFlash.color = Color.Lerp(damageFlash.color, Color.clear, flashSpeed * Time.deltaTime);
            }
            else
            {
                PlayerController.health -= pdmg;
                damageFlash.color        = flashColour;
                onCD = 1;
                time = Time.time;
            }
        }
        hpBar.localScale = new Vector3(2f, (origscaley * hp / maxhp), 1);

        if (hp <= 0)
        {
            FloatingTextController.bounty(bounty, this.transform.position.x, this.transform.position.y);
            Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
            KillEnemy(enemy);
            PlayerController.flow += bounty;
        }
    }