Exemple #1
0
 public void addUnit(Kit newUnit)
 {
     if (!Units.Contains(newUnit))
     {
         Units.Add(newUnit);
     }
 }
Exemple #2
0
        public UnitViewModel(AppConfig config, MainViewModel mvm)
        {
            m_config = config;
            m_mvm    = mvm;

            SendToSlotCommand             = new DelegateCommand <string>(SendToSlot, x => SelectedIdol != null);
            SaveCommand                   = new DelegateCommand(Save, () => !string.IsNullOrEmpty(UnitName));
            DeleteCommand                 = new DelegateCommand(Delete, () => Units.Contains(SelectedUnit));
            MoveToSlotCommand             = new DelegateCommand <string>(MoveToSlot, CanMoveToSlot);
            ResetSlotCommand              = new DelegateCommand <string>(ResetSlot, CanResetSlot);
            HighlightCommand              = new DelegateCommand <string>(Highlight, CanHighlight);
            CopyIidCommand                = new DelegateCommand(CopyIid, () => SelectedIdol != null);
            SetGuestCenterCommand         = new DelegateCommand(SetGuestCenter, () => SelectedIdol != null);
            CopyIidFromSlotCommand        = new DelegateCommand <string>(CopyIidFromSlot);
            SetGuestCenterFromSlotCommand = new DelegateCommand <string>(SetGuestCenterFromSlot);

            Idols  = new ListCollectionView(m_config.OwnedIdols);
            Filter = new IdolFilter(config, Idols, false);
            Filter.SetConfig(config.UnitIdolFilterConfig);

            Units = m_config.Units;

            TemporalUnit = new Unit();
            SelectedUnit = Units.FirstOrDefault();

            foreach (var option in config.UnitIdolSortOptions)
            {
                Idols.SortDescriptions.Add(option.ToSortDescription());
            }
        }
    private void SelectUnit(Unit unit)
    {
        bool clickedOwnUnit = unit != null && Units.Contains(unit);
        bool shouldUnselect = unit == null || CurrentUnit == unit || !turnManager.CanBeSelected(unit);

        CurrentUnit = shouldUnselect || !clickedOwnUnit ? null : unit;
    }
 public void AddUnit(GameObject unit)
 {
     if (Units.Contains(unit) == false)
     {
         Units.Add(unit);
     }
 }
Exemple #5
0
 public void addUnit(ElectronicUnit newUnit)
 {
     if (!Units.Contains(newUnit))
     {
         Units.Add(newUnit);
     }
 }
 public void AddUnits(List <GameObject> units)
 {
     units.ForEach(u =>
     {
         if (Units.Contains(u) == false)
         {
             Units.Add(u);
         }
     });
 }
        public virtual int SelectUnit(int unitId)
        {
            if (Units.Contains(unitId))
            {
                SelectedUnit = Units[unitId];

                return(TResult.S_OK);
            }

            return(TResult.E_InvalidArg);
        }
Exemple #8
0
        public bool TryAddUnit(TUnit unit)
        {
            unit.SetColor(TeamColor);
            if (Units.Contains(unit))
            {
                return(false);
            }

            Units.Add(unit);
            return(true);
        }
Exemple #9
0
 public Flowsheet AddUnit(ProcessUnit unit)
 {
     if (!Units.Contains(unit))
     {
         Units.Add(unit);
     }
     else
     {
         throw new InvalidOperationException("Unit " + unit.Name + " already included in flowsheet");
     }
     return(this);
 }
Exemple #10
0
 public override void Remove(ZooUnit unit)
 {
     if (Units.Contains(unit))
     {
         if (unit is Animal)
         {
             (unit as Animal).IsInZoo = false;
             Units.Remove(unit);
         }
     }
     else
     {
         throw new CannotRemoveUnitException("Невозможно удалить животное/клетку!");
     }
 }
Exemple #11
0
        private void RemoveUnit(TUnit unit)
        {
            if (!Units.Contains(unit))
            {
                return;
            }

            if (Units.Count == 0)
            {
                return;
            }

            Units.Remove(unit);
            if (Units.Count == 0)
            {
                TeamLose();
            }
        }
    private IEnumerator HandleMouseClick()
    {
        Vector3    clickedWorldPos = mainCamera.ScreenToWorldPoint(Input.mousePosition);
        GameObject clickedObject   = TilemapNavigator.Instance.GetObjectAtWorldPos(clickedWorldPos);

        if (clickedObject != null)
        {
            Unit clickedUnit = clickedObject.GetComponent <Unit>();

            if (CurrentUnit)
            {
                Vector3Int clickedCellPos = TilemapNavigator.Instance.WorldToCellPos(clickedWorldPos);
                yield return(StartCoroutine(PerformUnitAction(clickedCellPos, clickedUnit)));

                ChangeAttackMode(AttackModes.None);
            }
            else if (clickedUnit != null && Units.Contains(clickedUnit))
            {
                SelectUnit(clickedUnit);
            }
        }
    }
Exemple #13
0
 void SetUnitReferences(FactCollection Facts)
 {
     foreach (var fact in Facts)
     {
         if (fact.Unit == null)
         {
             var unitRef = fact.UnitRef;
             if (!string.IsNullOrEmpty(unitRef))
             {
                 if (!Units.Contains(unitRef))
                 {
                     throw new KeyNotFoundException(string.Format(ic, "Referenced unit '{0}' does not exist", unitRef));
                 }
                 fact.Unit = Units[unitRef];
             }
         }
         if (fact.Facts.Count > 0)
         {
             SetUnitReferences(fact.Facts);
         }
     }
 }
Exemple #14
0
 public bool IsInSense(BaseUnit unit) => Units.Contains(unit as TUnit);
Exemple #15
0
 /// <summary>
 /// Returns true if and only if the given GameObject exists in this Shard.
 /// </summary>
 /// <param name="gameObject">GameObject to test</param>
 /// <returns>as described</returns>
 public bool Exists(GameObject gameObject)
 {
     return(GameObjects.Contains(gameObject) ||
            Units.Contains(gameObject) ||
            Characters.Contains(gameObject));
 }
 //是否被指定单位检测到了
 public bool IsInDetection(BaseUnit unit) => Units.Contains(unit);
Exemple #17
0
 public bool Contains(Unit unit) => Units.Contains(unit);