Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        sideMove = Vector3.zero;

        input   = GetComponent <IInput>();
        moving  = GetComponent <CubeMoving>();
        content = GetComponent <CubeContent>();

        collider           = gameObject.AddComponent <BoxCollider>();
        collider.isTrigger = is_player;
        collider.size      = Vector3.one * content.width;

        rb             = gameObject.AddComponent <Rigidbody>();
        rb.useGravity  = false;
        rb.isKinematic = true;
        rb.angularDrag = 0;

        input.step_size = content.width;

        if (is_player)
        {
            content.GenerateColored(percent: 0.3f);
            World.UpdateInterface(this);
        }
    }