예제 #1
0
    void Start()
    {
        CH          = CHG.GetComponent <charHealth>();
        healthMax   = CH._getHealthMax();
        health      = CH._getHealth();
        healthBleck = health;



        BalanceMax   = CH._getBalancehMax();
        Balance      = CH._getBalance();
        BalanceBleck = Balance;

        ManaMax   = CH._getManaMax();
        Mana      = CH._getMana();
        ManaBleck = Mana;


        HealthBarRenderer      = HealthBar.GetComponent <SpriteRenderer>();
        HealthBleckBarRenderer = HealthBleckBar.GetComponent <SpriteRenderer>();
        HealthBarLenght        = HealthBarRenderer.size.x;

        BalanceBarRenderer      = BalanceBar.GetComponent <SpriteRenderer>();
        BalanceBleckBarRenderer = BalanceBleckBar.GetComponent <SpriteRenderer>();
        BalanceBarLenght        = BalanceBarRenderer.size.x;

        ManaBarRenderer      = ManaBar.GetComponent <SpriteRenderer>();
        ManaBleckBarRenderer = ManaBleckBar.GetComponent <SpriteRenderer>();
        ManaBarLenght        = ManaBarRenderer.size.x;

        ManaPointBarRenderer      = ManaPointBar.GetComponent <SpriteRenderer>();
        ManaPointBleckBarRenderer = ManaPointBleckBar.GetComponent <SpriteRenderer>();
        ManaPointBarLenght        = ManaPointBarRenderer.size.x;
    }
    // Update is called once per frame
    void Update()
    {
        HealthVar  = CH._getHealth();
        BalanceVar = CH._getBalance();

        healthSR.size  = new Vector2(MaxHealthSize * HealthVar / HealthMaxVar, healthSR.size.y);
        balanceSR.size = new Vector2(MaxBalanceSize * BalanceVar / BalanceMaxVar, balanceSR.size.y);
    }
    void getPresentReason()
    {
        presentReason = new int[12];

        for (int i = 0; i < presentReason.Length; i++)
        {
            presentReason[i] = -1;
        }

        // 0 - Target type
        // 1 - Target move
        // 2 - Target action
        // 3 - Target HP
        // 4 - Target Balance
        // 5 - Target Mana

        // 6 -  distance
        // 7 -  Self Move
        // 8 -  Self Action
        // 9 -  Self HP
        // 10 - Self Balance
        // 11 - Self Mana



        bool tst = Target.tag == "Char";

        presentReason[0] = tst?1:0;

        if (tst)
        {
            presentReason[1] = TargetCharMove.getIsMoved() ? 1:0;
            presentReason[2] = TargetFightManager._getProcess();
            presentReason[3] = (int)(((float)TargetHelth._getHealth() / (float)TargetHelth._getHealthMax()) * 100);
            presentReason[4] = (int)(((float)TargetHelth._getBalance() / (float)TargetHelth._getBalancehMax()) * 100);
            presentReason[5] = (int)(((float)TargetHelth._getMana() / (float)TargetHelth._getManaMax()) * 100);

            presentReason[6] = (int)(Vector2.Distance(
                                         new Vector2(transform.position.x, transform.position.y),
                                         new Vector2(Target.transform.position.x, Target.transform.position.y)) * 10);

            presentReason[7]  = SelfCharMove.getIsMoved() ? 1 : 0;
            presentReason[8]  = SelfFightManager._getProcess();
            presentReason[9]  = (int)(((float)SelfHelth._getHealth() / (float)SelfHelth._getHealthMax()) * 100);
            presentReason[10] = (int)(((float)SelfHelth._getBalance() / (float)SelfHelth._getBalancehMax()) * 100);
            presentReason[11] = (int)(((float)SelfHelth._getMana() / (float)SelfHelth._getManaMax()) * 100);
        }
    }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        health = CH._getHealth();

        Balance = CH._getBalance();

        Mana = CH._getMana();


        HealtText.text              = healthMax.ToString() + "/" + health.ToString();
        HealthBarRenderer.size      = new Vector2(((float)health / (float)healthMax) * HealthBarLenght, HealthBarRenderer.size.y);
        HealthBleckBarRenderer.size = new Vector2(((float)healthBleck / (float)healthMax) * HealthBarLenght, HealthBarRenderer.size.y);

        if (healthBleck > health)
        {
            HealthTimer += Time.deltaTime;
            if (HealthTimer > 0.05f)
            {
                healthBleck -= 5;
                HealthTimer  = 0;
            }
        }
        else if (healthBleck < health)
        {
            healthBleck = health;
            HealthTimer = 0;
        }
        if (health < 0)
        {
            health = 0;
        }
        if (health > healthMax)
        {
            health = healthMax;
        }



        BalanceText.text             = BalanceMax.ToString() + "/" + Balance.ToString();
        BalanceBarRenderer.size      = new Vector2(((float)Balance / (float)BalanceMax) * BalanceBarLenght, BalanceBarRenderer.size.y);
        BalanceBleckBarRenderer.size = new Vector2(((float)BalanceBleck / (float)BalanceMax) * BalanceBarLenght, BalanceBarRenderer.size.y);

        if (BalanceBleck > Balance)
        {
            BalanceTimer += Time.deltaTime;
            if (BalanceTimer > 0.05f)
            {
                BalanceBleck -= 5;
                BalanceTimer  = 0;
            }
        }
        else if (BalanceBleck < Balance)
        {
            BalanceBleck = Balance;
            BalanceTimer = 0;
        }
        if (Balance < 0)
        {
            Balance = 0;
        }
        if (Balance > BalanceMax)
        {
            Balance = BalanceMax;
        }



        ManaText.text             = ManaMax.ToString() + "/" + Mana.ToString();
        ManaBarRenderer.size      = new Vector2(((float)Mana / (float)ManaMax) * ManaBarLenght, ManaBarRenderer.size.y);
        ManaBleckBarRenderer.size = new Vector2(((float)ManaBleck / (float)ManaMax) * ManaBarLenght, ManaBarRenderer.size.y);

        if (ManaBleck > Mana)
        {
            ManaTimer += Time.deltaTime;
            if (ManaTimer > 0.05f)
            {
                ManaBleck -= 5;
                ManaTimer  = 0;
            }
        }
        else if (ManaBleck < Mana)
        {
            ManaBleck = Mana;
            ManaTimer = 0;
        }
        if (Mana < 0)
        {
            Mana = 0;
        }
        if (Mana > ManaMax)
        {
            Mana = ManaMax;
        }



        ManaPointBarRenderer.size      = new Vector2(((float)ManaPoint / (float)ManaPointMax) * ManaPointBarLenght, ManaPointBarRenderer.size.y);
        ManaPointBleckBarRenderer.size = new Vector2(((float)ManaPointBleck / (float)ManaPointMax) * ManaPointBarLenght, ManaPointBarRenderer.size.y);

        if (ManaPointBleck > ManaPoint)
        {
            ManaPointTimer += Time.deltaTime;
            if (ManaPointTimer > 0.3f)
            {
                ManaPointBleck -= 1;
                ManaPointTimer  = 0;
            }
        }
        else if (ManaPointBleck < ManaPoint)
        {
            ManaPointBleck = ManaPoint;
            ManaPointTimer = 0;
        }
        if (ManaPoint < 0)
        {
            ManaPoint = 0;
        }
        if (ManaPoint > ManaPointMax)
        {
            ManaPoint = ManaPointMax;
        }
    }