Пример #1
0
 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);
        }
Пример #3
0
 public void Dispose()
 {
     if (_addToGlobalList)
     {
         _allLists.Remove(this);
     }
 }
Пример #4
0
        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);
        }
Пример #5
0
 public void RemoveObserver <T>(IReceive <T> handler)
 {
     _messageReceivers.Remove(handler);
 }
Пример #6
0
 public void RemoveObserver <T>(IReceive <T> handler) where T : IEntityMessage
 {
     _messageReceivers.Remove(handler);
 }