Beispiel #1
0
        public void AddMainShipShieldModifier(AssemblePartInfo partInfo, MainShipShieldInfo shieldInfo, ModifierBase modifierBase)
        {
            if (modifierBase == null)
            {
                DebugPlus.LogError("Modifier Base Data is null");
                return;
            }
            if (modifierBase.ParseTargetType(modifierBase.Target) != ModifierTarget.MainShipShield)
            {
                DebugPlus.LogError("ModifierTargetError  Name=" + modifierBase.ModifierName);
                return;
            }

            ModifierData data = null;

            switch (modifierBase.ParseModifierShieldType(modifierBase.effectType))
            {
            case  ModifierMainShip_Shield.Shield_open_init:
                if (!IsAddMainShipShieldModifier(shieldInfo, modifierBase))
                {
                    data = ModifierData.Create(modifierBase, delegate
                    {
                        shieldInfo.AddShieldOpenInit_Assemble(partInfo.modifierRootType, partInfo.UID, partInfo.partID, (int)modifierBase.Value);
                    });
                }
                break;
            }

            if (data != null)
            {
                ///ADD modifier
                shieldInfo.shipShieldModifier.OnAddModifier(data);
            }
        }
        public void SetUpItem(MainShipShieldInfo info)
        {
            _info     = info;
            direction = info.direction;

            UpdateShieldLevelMax();
        }
Beispiel #3
0
        private bool IsAddMainShipShieldModifier(MainShipShieldInfo info, ModifierBase modifier)
        {
            ModifierData oldData = info.shipShieldModifier.GetModifierByID(modifier.ModifierName);

            if (oldData != null)
            {
                switch (modifier.OverlapType)
                {
                case ModifierOverlapType.TimeReset:
                    oldData.ResetTime();
                    break;
                }
                return(true);
            }
            return(false);
        }