add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class parentAssignedSystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public GameObject parentGameObject;
|
||||
|
||||
[Space]
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool parentAssigned;
|
||||
|
||||
|
||||
public void assignParent (GameObject newParent)
|
||||
{
|
||||
parentGameObject = newParent;
|
||||
|
||||
parentAssigned = parentGameObject != null;
|
||||
}
|
||||
|
||||
public GameObject getAssignedParent ()
|
||||
{
|
||||
if (!parentAssigned) {
|
||||
if (parentGameObject == null) {
|
||||
parentGameObject = gameObject;
|
||||
}
|
||||
|
||||
parentAssigned = parentGameObject != null;
|
||||
}
|
||||
|
||||
return parentGameObject;
|
||||
}
|
||||
|
||||
public Transform getAssignedParentTransform ()
|
||||
{
|
||||
if (!parentAssigned) {
|
||||
if (parentGameObject == null) {
|
||||
parentGameObject = gameObject;
|
||||
}
|
||||
|
||||
parentAssigned = parentGameObject != null;
|
||||
}
|
||||
|
||||
if (parentAssigned) {
|
||||
return parentGameObject.transform;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user