Skip to main content

Unity (mouse & clone)



Squeezed out some time to move forward a little. 
No. I'm not creating a game, but a simulator, trying to solve currently encountered problem. 

How could you tell someone the time management is harmful, if the culture of environment is "the superior knows the all"? I knew this is far-fetched. And hopefully I soon need not to worry about it, but giving this out as a gift. 


Useful function:
public void OnMouseUp()
    {
        if (!bMouseDown) return;
        //keep it simple. just return if irrelevant
        bMouseDown = false;
        if (id != 0)
        {
            origin = transform.position;
            return;
        }
        //if the genuin, make clone. 
        Vector3 pos = Input.mousePosition;
        pos = Camera.main.ScreenToWorldPoint(pos);
        pos.z = origin.z;
        if (pos.x > Boundary.x || pos.y < Boundary.y)
        {
            stationact newob = Instantiate(this);
            newob.id = ++idMax;
            newob.transform.position = transform.position;
            newob.origin = transform.position;
            gmgr.RegisterStation(newob);
        }
        transform.position = origin;
    }


Hmm.... maybe I should refer to the current position instead of origin.... since origin is only used by genuine copy... Will update next time. 

Comments