12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using System;
- using UnityEngine;
- namespace Xft
- {
- public class XftEvent
- {
- public XftEvent(XEventType type, XftEventComponent owner)
- {
- this.m_type = type;
- this.m_owner = owner;
- }
- public Camera MyCamera
- {
- get
- {
- return this.m_owner.Owner.MyCamera;
- }
- }
- protected Camera FindMyCamera()
- {
- int num = 1 << this.m_owner.gameObject.layer;
- Camera[] array = UnityEngine.Object.FindObjectsOfType(typeof(Camera)) as Camera[];
- int i = 0;
- int num2 = array.Length;
- while (i < num2)
- {
- Camera camera = array[i];
- if ((camera.cullingMask & num) != 0)
- {
- return camera;
- }
- i++;
- }
- UnityEngine.Debug.LogError("can't find proper camera for event:" + this.m_type);
- return null;
- }
- public bool CanUpdate
- {
- get
- {
- return this.m_canUpdate;
- }
- set
- {
- this.m_canUpdate = value;
- }
- }
- public virtual void OnBegin()
- {
- this.CanUpdate = true;
- }
- public virtual void Initialize()
- {
- }
- public virtual void Update(float deltaTime)
- {
- }
- public virtual void Reset()
- {
- this.m_elapsedTime = 0f;
- this.CanUpdate = false;
- }
- protected XEventType m_type;
- protected XftEventComponent m_owner;
- protected float m_elapsedTime;
- protected bool m_canUpdate;
- protected Camera m_myCamera;
- }
- }
|