public void ApplyStatus(StatusFactory factory, BaseAvatar source) { if (currentEffects.Contains(factory)) { return; } Status s = factory.GetStatus(this, source); currentEffects.Add(factory); s.OnUnapply += () => { Debug.Log("OnUnapply"); currentEffects.Remove(factory); OnStatusRemoved(s); }; s.Apply(); OnStatusApplied(s); }
void OnEvent(PlayerRespawnEvent eventArgs) { if (Occupied || eventArgs.Consumed) { return; } eventArgs.Consumed = true; //TODO(james7132): Fix this _character = eventArgs.Player.PlayerObject.GetComponentInChildren <Character>(); _character.Movement.RpcMove(transform.position); _character.ResetCharacter(); _invincibility = Status.Apply <Invincibility>(_character, _invicibilityTimer + _platformTimer); _timer = 0f; eventArgs.Player.PlayerObject.SetActive(true); Occupied = true; _isOccupied = true; }
/** * Private methods */ public void ApplyStatus(GameObject projectile, Status status) { Type type = status.GetType(); Status alreadyApplied = gameObject.GetComponent(type) as Status; // New Status to apply if (!alreadyApplied) { Status appliedStatus = gameObject.AddComponent(type) as Status; appliedStatus.Copy(status); appliedStatus.Apply(gameObject, projectile); } // Status currently applied else { alreadyApplied.Refresh(); alreadyApplied.Apply(gameObject, projectile); } }
public void AddStatus(Character caster, string status) { if (statuses == null) { statuses = new List <Status>(); } Status st = GameData.Instance.GetStatus(status); if (st.name != "" || HasStatus(status)) { return; } st.SetCaster(caster); statuses.Add(st); if (!st.continuous) { st.Apply(this); } }
public new void Apply(Status status) { status.Apply(DeliveryPack); base.Apply(status); }