123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- using System;
- using System.Diagnostics;
- using UnityEngine;
- namespace SRF
- {
- public abstract class SRMonoBehaviour : MonoBehaviour
- {
- public Transform CachedTransform
- {
- [DebuggerNonUserCode]
- [DebuggerStepThrough]
- get
- {
- if (this._transform == null)
- {
- this._transform = base.transform;
- }
- return this._transform;
- }
- }
- public Collider CachedCollider
- {
- [DebuggerStepThrough]
- [DebuggerNonUserCode]
- get
- {
- if (this._collider == null)
- {
- this._collider = base.GetComponent<Collider>();
- }
- return this._collider;
- }
- }
- public Collider2D CachedCollider2D
- {
- [DebuggerStepThrough]
- [DebuggerNonUserCode]
- get
- {
- if (this._collider2D == null)
- {
- this._collider2D = base.GetComponent<Collider2D>();
- }
- return this._collider2D;
- }
- }
- public Rigidbody CachedRigidBody
- {
- [DebuggerStepThrough]
- [DebuggerNonUserCode]
- get
- {
- if (this._rigidBody == null)
- {
- this._rigidBody = base.GetComponent<Rigidbody>();
- }
- return this._rigidBody;
- }
- }
- public Rigidbody2D CachedRigidBody2D
- {
- [DebuggerStepThrough]
- [DebuggerNonUserCode]
- get
- {
- if (this._rigidbody2D == null)
- {
- this._rigidbody2D = base.GetComponent<Rigidbody2D>();
- }
- return this._rigidbody2D;
- }
- }
- public GameObject CachedGameObject
- {
- [DebuggerStepThrough]
- [DebuggerNonUserCode]
- get
- {
- if (this._gameObject == null)
- {
- this._gameObject = base.gameObject;
- }
- return this._gameObject;
- }
- }
- public new Transform transform
- {
- get
- {
- return this.CachedTransform;
- }
- }
- [DebuggerNonUserCode]
- [DebuggerStepThrough]
- protected void AssertNotNull(object value, string fieldName = null)
- {
- SRDebugUtil.AssertNotNull(value, fieldName, this);
- }
- [DebuggerNonUserCode]
- [DebuggerStepThrough]
- protected void Assert(bool condition, string message = null)
- {
- SRDebugUtil.Assert(condition, message, this);
- }
- [Conditional("UNITY_EDITOR")]
- [DebuggerNonUserCode]
- [DebuggerStepThrough]
- protected void EditorAssertNotNull(object value, string fieldName = null)
- {
- this.AssertNotNull(value, fieldName);
- }
- [Conditional("UNITY_EDITOR")]
- [DebuggerNonUserCode]
- [DebuggerStepThrough]
- protected void EditorAssert(bool condition, string message = null)
- {
- this.Assert(condition, message);
- }
- private Collider _collider;
- private Transform _transform;
- private Rigidbody _rigidBody;
- private GameObject _gameObject;
- private Rigidbody2D _rigidbody2D;
- private Collider2D _collider2D;
- }
- }
|