示例#1
0
    // Update is called once per frame
    void Update()
    {
        Shooter = GameObject.FindGameObjectWithTag("Player")
                  .GetComponent <PlayerStatus>().Primary.GetComponent <ShooterBehavior>();

        MAX             = Mathf.CeilToInt(actor.MaxEnergy);
        E_CURRENT_INT   = Mathf.FloorToInt(actor.Energy);
        E_CURRENT_FLOAT = Mathf.FloorToInt((actor.Energy - E_CURRENT_INT) * 10);
        Percentage      = Mathf.CeilToInt((actor.Energy / actor.MaxEnergy) * 1000);

        text.text = Shooter.Name + "\n" + E_CURRENT_INT + "." + E_CURRENT_FLOAT
                    + "/" + MAX + "\n" + "En:" + Mathf.CeilToInt(Percentage / 10) + "."
                    + Mathf.CeilToInt(((actor.Energy / actor.MaxEnergy) * 1000 - Percentage) / 100) + "%";

        if (Percentage > 1000)
        {
            GaugeBase.fillAmount  = 1;
            GaugeExtra.fillAmount = (actor.Energy / actor.MaxEnergy) - 1f;
        }
        else
        {
            GaugeBase.fillAmount  = (actor.Energy / actor.MaxEnergy);
            GaugeExtra.fillAmount = 0f;
        }
    }
示例#2
0
// Update is called once per frame
    void Update()
    {
        PlayerGun  = player.GetComponentInChildren <ShooterBehavior>();
        Maxlife    = Mathf.RoundToInt(Actor.MaxLife * 10);
        Life       = Mathf.RoundToInt(Actor.CurrentLife * 10);
        bulletrest = PlayerGun.ammo.RestBullet;
        bulletMax  = PlayerGun.ammo.MagCap;

        if (gameObject.name == "StatusWeapon")
        {
            if (player.GetComponentInChildren <ShooterBehavior>().Reloading == true)
            {
                i           += Time.deltaTime;
                WeaponString = "Reloading " +
                               Mathf.CeilToInt((player.GetComponentInChildren <ShooterBehavior>()
                                                .stat_Time.Reload - i) * 100);
            }
            else
            {
                i            = 0;
                WeaponString = "Ammo : " +
                               bulletrest + "/" + bulletMax;
            }
            text.text = WeaponString;
        }

        if (gameObject.name == "StatusHealth")
        {
            text.text = Life + "/" + Maxlife;
        }
        this.transform.SetSiblingIndex(10);
    }
示例#3
0
 void Start()
 {
     rb2d           = GetComponent <Rigidbody2D>();
     weapon         = gameObject.GetComponentInChildren <ShooterBehavior>();
     startingHealth = health;
     playerName     = transform.name.Split('_')[1];
     uiManager      = GameObject.Find("GameScreenUI").GetComponent <UIManager>();
 }
 void Awake()
 {
     weapon          = gameObject.GetComponentInChildren <ShooterBehavior>();
     anim            = GetComponent <Animator>();
     movementManager = GetComponent <AgentWithMovePattern>();
 }