예제 #1
0
    private void instantiateRoomObjectGameObject(string name, Vector2 position)
    {
        GameObject roomObjectGameObject = new GameObject(name);
        RoomObject roomObject           = getRoomObjectFromDirectory(name);

        RoomObjectUI roomObjectUI = roomObjectGameObject.AddComponent <RoomObjectUI>();

        roomObjectUI.setupRoomObjectGameObject(roomObjectGameObject, roomObject);

        roomObjectGameObject.transform.position = position;
    }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        RoomObjectUI other = collision.gameObject.GetComponent <RoomObjectUI>();

        if (other != null)    //if collided thing has Object component, need to check if it's tall enough to collide
        {
            if (height < other.getHeight())
            {
                destroyProjectile();
            }
        }
        else
        {
            destroyProjectile();
        }
    }