コード例 #1
0
    public void IncrementAmmo(Bullet.Kind k)
    {
        Magazine magazine = magazines [(int)k];
        int      ammo     = Mathf.RoundToInt(magazine.maxBullets * 0.1f);
        int      newAmmo  = magazine.remainingBullets + ammo;

        magazine.remainingBullets = (magazine.maxBullets < newAmmo) ? magazine.maxBullets : newAmmo;
    }
コード例 #2
0
    void changeColor()
    {
        Magazine[] magazines = tank.GetComponent <AmmoController> ().magazines;
        Bullet     bullet    = magazines [Random.Range(0, magazines.Length)].bullet;

        kind = bullet.kind;
        transform.Find("Ammo").GetComponent <MeshRenderer> ().materials [0].color           = bullet.color;
        transform.Find("Minimap object").GetComponent <MeshRenderer> ().materials [0].color = bullet.color;
    }