public override void Replay(TEventModel model) { if (model == null) { _debugger.LogWarning("Model is null. Is this eventType improperly cast? Skipping replay"); return; } var gameObject = GameObjectFinder.Find(model.GameObjectName); if (gameObject == null) { _debugger.LogWarning($"GameObject :{model.GameObjectName} not found for event {model.EventType}. Skipping replay"); return; } var component = gameObject.GetComponent(typeof(TComponent)) as TComponent; if (component == null || ReferenceEquals(null, component)) { _debugger.LogWarning($"Component :{model.ComponentType} not found on gameobject :{model.GameObjectName} for event {model.EventType}. Skipping replay"); return; } OnGetComponent(model, component); }
private void ReplayEvent(EventModelBase modelBase, float currentTimeSinceStartSeconds) { var eventType = modelBase.EventType; var instruction = _replayInstructions.Find(instr => instr.Name == eventType); if (instruction != null) { if (!instruction.EnableReplay) { if (modelBase is ComponentEventModel comp) { _debugger.Log($"Replay disabled time:{currentTimeSinceStartSeconds:0.00}, type:{comp.EventType}, gameObject:{comp.GameObjectName}, comp:{comp.ComponentType}"); } else { _debugger.Log($"Replay disabled time:{currentTimeSinceStartSeconds:0.00}, type:{modelBase.EventType}"); } return; } if (modelBase is ComponentEventModel compo) { _debugger.Log($"Replaying Event: time:{currentTimeSinceStartSeconds:0.00}, type:{compo.EventType}, gameObject:{compo.GameObjectName}, comp:{compo.ComponentType}"); } else { _debugger.Log($"Replaying Event: time:{currentTimeSinceStartSeconds:0.00}, type:{modelBase.EventType}"); } instruction.Replay(modelBase); return; } _debugger.LogWarning($"No event type found named:{eventType}"); }
public bool CurrentlyAttackable = true; //left public so that other scripts can modify variable public override void Awake() { base.Awake(); m_health = StartHealth; if (m_health <= 0) { IDebug.LogWarning("Attackable " + m_name + ": m_health is <= 0. Was this on purpose?"); m_isDead = true; } m_isDead = StartDead; m_attackable = CurrentlyAttackable; }