41 lines
974 B
C#
41 lines
974 B
C#
// Felix-Bang:FBSingleton
|
||
// へ /|
|
||
// /\7 ∠_/
|
||
// / │ / /
|
||
// │ Z _,< / /`ヽ
|
||
// │ ヽ / 〉
|
||
// Y ` / /
|
||
// イ● 、 ● ⊂⊃〈 /
|
||
// () へ | \〈
|
||
// >ー 、_ ィ │ //
|
||
// / へ / ノ<| \\
|
||
// ヽ_ノ (_/ │//
|
||
// 7 |/
|
||
// >―r ̄ ̄`ー―_
|
||
// Describe:单例模式
|
||
// Createtime:2018/9/18
|
||
|
||
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
namespace FBFramework
|
||
{
|
||
public abstract class FBSingleton<T> : MonoBehaviour
|
||
where T:MonoBehaviour
|
||
{
|
||
private static T f_instance=null;
|
||
public static T Instance
|
||
{
|
||
get { return f_instance; }
|
||
}
|
||
|
||
protected virtual void Awake()
|
||
{
|
||
f_instance = this as T;
|
||
}
|
||
}
|
||
}
|
||
|