You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
1.3 KiB
C#
82 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
namespace Projectiles
|
|
{
|
|
public abstract class CoreBehaviour : MonoBehaviour
|
|
{
|
|
// PUBLIC MEMBERS
|
|
|
|
public new string name
|
|
{
|
|
get
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (Application.isPlaying == false)
|
|
return base.name;
|
|
#endif
|
|
if (_nameCached == false)
|
|
{
|
|
_cachedName = base.name;
|
|
_nameCached = true;
|
|
}
|
|
|
|
return _cachedName;
|
|
}
|
|
set
|
|
{
|
|
if (string.CompareOrdinal(_cachedName, value) != 0)
|
|
{
|
|
base.name = value;
|
|
_cachedName = value;
|
|
_nameCached = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
public new GameObject gameObject
|
|
{
|
|
get
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (Application.isPlaying == false)
|
|
return base.gameObject;
|
|
#endif
|
|
if (_gameObjectCached == false)
|
|
{
|
|
_cachedGameObject = base.gameObject;
|
|
_gameObjectCached = true;
|
|
}
|
|
|
|
return _cachedGameObject;
|
|
}
|
|
}
|
|
|
|
public new Transform transform
|
|
{
|
|
get
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (Application.isPlaying == false)
|
|
return base.transform;
|
|
#endif
|
|
if (_transformCached == false)
|
|
{
|
|
_cachedTransform = base.transform;
|
|
_transformCached = true;
|
|
}
|
|
|
|
return _cachedTransform;
|
|
}
|
|
}
|
|
|
|
// PRIVATE MEMBERS
|
|
|
|
private string _cachedName;
|
|
private bool _nameCached;
|
|
private GameObject _cachedGameObject;
|
|
private bool _gameObjectCached;
|
|
private Transform _cachedTransform;
|
|
private bool _transformCached;
|
|
}
|
|
}
|