30 lines
807 B
C#
30 lines
807 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
using UnityEngine;
|
|
|
|
public class MousePreview : MonoBehaviour
|
|
{
|
|
|
|
// show mousePreviewObj in mouse position
|
|
public void changePreviewTo(GameObject mousePreviewObj)
|
|
{
|
|
deleteAllPreviewModele();
|
|
Instantiate(mousePreviewObj, this.transform.position, Quaternion.identity, this.transform);
|
|
}
|
|
public void updatePreviewPosition(Vector3 previewPos)
|
|
{
|
|
// move this gameobject to previewPos
|
|
this.transform.position = previewPos;
|
|
}
|
|
public void deleteAllPreviewModele()
|
|
{
|
|
// delete all child object
|
|
foreach (Transform childObj in this.transform)
|
|
{
|
|
// destroy child
|
|
Destroy(childObj.gameObject);
|
|
}
|
|
}
|
|
}
|