Files
TheAuction-GS/Assets/ItemsToSell/Object.cs

35 lines
935 B
C#

using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
public class Object : MonoBehaviour {
[SerializeField] private ObjectSO _objectSo;
private IObjectParentHolder _objectParent;
public ObjectSO ObjectSo {
get => _objectSo;
set => _objectSo = value;
}
public IObjectParentHolder getObjectParent() {
return _objectParent;
}
public void setObjectParent(IObjectParentHolder objectParent) {
if (this._objectParent != null) {
this._objectParent.ClearObject();
}
this._objectParent = objectParent;
if (objectParent.HasObject()) {
Debug.LogError("Parent has already something on it?");
}
objectParent.SetObject(this);
transform.parent = _objectParent.GetHolderTransform();
transform.localPosition = Vector3.zero;
}
}