private void UpdateSprite(ref SpriteColorWatch colorStage) { if (colorStage.ColorComponent == null) { _colorList.Remove(colorStage); return; } colorStage.ColorComponent.Renderer.transform.localScale = new Vector3( colorStage.Scale.x * colorStage.Tween.Get(), colorStage.Scale.y, colorStage.Scale.z); if (colorStage.Stage == 1) { colorStage.ColorComponent.UpdateCurrentColor( Color.Lerp( Color.red, colorStage.ColorComponent.BaseColor, colorStage.Tween.Get())); } if (colorStage.Tween.Active) { return; } if (colorStage.Stage == 0) { colorStage.Tween.Restart(colorStage.ColorComponent.DmgMaxScale, 1); colorStage.Stage = 1; } else { colorStage.ColorComponent.AnimatingColor = false; colorStage.ColorComponent.UpdateBaseColor(); _colorList.Remove(colorStage); } }
public bool TryAddCommand(Command cmd) { if (!cmd.CanStart()) { return(false); } var otherCmd = GetCommand(cmd.Owner.Entity); if (otherCmd != null) { if (!otherCmd.CanBeReplacedBy(cmd)) { cmd.Owner.Post(new StatusUpdate(cmd.Owner, "Can't replace current command")); return(false); } otherCmd.Cancel(); _commands.Remove(otherCmd); } cmd.StartCommand(); #if DEBUG DebugLog.Add(cmd.Owner.Entity.DebugId + " started command " + cmd.GetType()); #endif _commands.Add(cmd); return(true); }
public void Dispose() { if (_addToGlobalList) { _allLists.Remove(this); } }
public bool TryAddCommand(Command cmd) { if (!cmd.CanStart()) { return(false); } var otherCmd = GetCommand(cmd.EntityOwner); if (otherCmd != null) { if (!otherCmd.CanBeReplacedBy(cmd)) { cmd.EntityOwner.PostAll(new StatusUpdate("Can't replace current command")); return(false); } otherCmd.Cancel(); _commands.Remove(otherCmd); } cmd.StartCommand(); _commands.Add(cmd); return(true); }
public void RemoveObserver <T>(IReceive <T> handler) { _messageReceivers.Remove(handler); }
public void RemoveObserver <T>(IReceive <T> handler) where T : IEntityMessage { _messageReceivers.Remove(handler); }