Programare C++ Lectia 3

public class INEX : MonoBehaviour
{
float pasy = 0.05f;
float pasz = 0.01f;
float pasx = 0.01f;
Vector3 pos1 = new Vector3(8.2657f, 91.61992f, 1);
// Start is called before the first frame update
void Start()
{
transform.localScale = pos1;
}

// Update is called once per frame
void Update()
{
    if (pos1.x > 8.2657f)
    {
        pasx= -0.025f;
    }
    if (pos1.x < 0)
    {
        pasx= 0.025f;
    }
    if (pos1.y > 91.61992)
    {
        pasy= -0.025f;
    }
    if (pos1.y < 0)
    {
        pasy= 0.025f;
    }
    if (pos1.z > 1)
    {
        pasz= -0.025f;
    }
    if (pos1.z < 0)
    {
        pasz= 0.025f;
    }
    pos1.x += pasx;
    pos1.z += pasz;
    pos1.y += pasy;
    transform.localScale = pos1;
}

}

public class gigeluextrem5 : MonoBehaviour
{
float pas = -0.0085f;
float pas1 = -0.0085f;
float pas2 = -0.0085f;
Vector3 pos1 = new Vector3(9, 9, 9);
// Start is called before the first frame update
void Start()
{
transform.localScale = pos1;
}

// Update is called once per frame
void Update()
{
    if (pos1.x > 9)
    {
        pas+= -0.0085f;
    }
    if (pos1.x < 0)
    {
        pas+= 0.0085f;
    }
    pos1.x+= pas;

    if (pos1.y > 9)
    {
        pas1 += -0.0085f;
    }
    if (pos1.y < 0)
    {
        pas1 += 0.0085f;
    }
    pos1.y += pas1;

    if (pos1.z > 9)
    {
        pas2 += -0.0085f;
    }
    if (pos1.z < 0)
    {
        pas2 += 0.0085f;
    }
    pos1.z += pas2;
    transform.localScale = pos1;
}

}