public override void Initialize() { _hp = _maxHP; _fallenProc = Collisions.CollisionBus.Subscribe(TagName.Ball, TagName.LaserFence, (ball, fence, collision) => { ApplyDamage(_fallenDamage); }); logger.Log("Initialized from :{0}", StackInfos.GetCallerTrace(2)); _instance = FindObjectOfType <PlayerCore>(); }
public static void Notify(Timing timing, GameObject objA, GameObject objB, Collision2D collision) { Key key = new Key(timing, objA.GetEnumTagName(), objB.GetEnumTagName()); if (_handlers.ContainsKey(key)) { _handlers[key](objA, objB, collision); } else { _handlers.Add(key, (v1, v2, v3) => { }); #if COL_BUS_DEBUG Debug.LogFormat("Key added [empty] from [{0}]", StackInfos.GetCallerFullName()); #endif } }
//! --------functions-------- public static Key Subscribe(Timing timing, TagName tagA, TagName tagB, OnCollisionHandler handler) { Key key = new Key(timing, tagA, tagB); if (_handlers.ContainsKey(key)) { _handlers[key] += handler; } else { _handlers.Add(key, handler); #if COL_BUS_DEBUG Debug.LogFormat("Key added [{0}] from [{1}]", key.ToString(), StackInfos.GetCallerFullName()); #endif } return(key); }
//! ----overrides---- public override void Initialize() { base.Initialize(); seeker.onLocked += (enemy) => { var vfx = TF.ObjectPool.Alloc(_lockOnMarkerVFX, 1f); vfx.transform.position = enemy.transform.position; Observable.Interval(System.TimeSpan.FromSeconds(0.016f)).Subscribe(_ => { vfx.transform.position = enemy.transform.position; }).Delay(1f).Dispose(); }; Debug.Log("Initialize"); _disposer = Observable.Interval(System.TimeSpan.FromSeconds(_smokeInterval)).Subscribe(_ => { var vfx = TF.ObjectPool.Alloc(_smokeVFX, 1f); vfx.transform.position = transform.position; }); var caller = StackInfos.GetCallerFullName(); Debug.LogFormat("caller:{0}", caller); }