コード例 #1
0
        public override void Upgrade(SpecialComponent component)
        {
            var reduceArmor = component as ReduceArmorComponent;

            if (reduceArmor == null)
            {
                Debug.LogWarning("Invalid Component");
                return;
            }

            reduceArmor.Amount.Value = PowerIncreaseType.Increase(reduceArmor.Amount.Value, PowerByAmount);

            float newChance = ChanceIncreaseType.Increase(reduceArmor.Chance, ChanceByAmount);

            if (reduceArmor.ChanceHasUpperLimit)
            {
                reduceArmor.Chance = Math.Min(
                    newChance,
                    reduceArmor.ChanceUpperLimit
                    );
            }
            else
            {
                reduceArmor.Chance = newChance;
            }
        }
コード例 #2
0
 private SpecialButton FindButton(SpecialComponent component)
 {
     foreach (SpecialButton button in buttons)
     {
         if (button.IsEqualTo(component.GetSpecialType()))
         {
             return(button);
         }
     }
     return(null);
 }
コード例 #3
0
 void Start()
 {
     meshAgent         = GetComponent <NavMeshAgent>();
     attackComponent   = GetComponent <AttackComponent>();
     movementComponent = GetComponent <MovementComponent>();
     playerIdComponent = GetComponent <PlayerIdComponent>();
     specialComponent  = GetComponent <SpecialComponent>();
     orientator        = GetComponentInChildren <AnimatorOrientatorPlayer>();
     if (playerIdComponent == null)
     {
         throw new ArgumentNullException("PlayerIdComponent is not assigned to player");
     }
 }
コード例 #4
0
        public override void CopyDataToTargetComponent(SpecialComponent targetComponent)
        {
            var target = targetComponent as PoisonComponent;

            if (target == null)
            {
                Debug.LogError("Invalid component");
                return;
            }

            target.Dps      = Dps;
            target.Duration = Duration;
        }
コード例 #5
0
        public override void CopyDataToTargetComponent(SpecialComponent targetComponent)
        {
            var target = targetComponent as ReduceSpeedComponent;

            if (target == null)
            {
                Debug.LogError("Invalid component");
                return;
            }

            target.Amount     = Amount;
            target.AmountType = AmountType;
            target.Duration   = Duration;
        }
コード例 #6
0
        public override void CopyDataToTargetComponent(SpecialComponent targetComponent)
        {
            var target = targetComponent as ReduceArmorComponent;

            if (target == null)
            {
                Debug.LogError("Invalid component");
                return;
            }

            target.Amount = Amount;
            target.Chance = Chance;
            target.ChanceHasUpperLimit = ChanceHasUpperLimit;
            target.ChanceUpperLimit    = ChanceUpperLimit;
        }
コード例 #7
0
        public override void CopyDataToTargetComponent(SpecialComponent targetComponent)
        {
            var target = targetComponent as SplashDamageComponent;

            if (target == null)
            {
                Debug.LogError("Invalid component");
                return;
            }

            target.Damage        = Damage;
            target.SplashRadius  = SplashRadius;
            target.HasUpperLimit = HasUpperLimit;
            target.UpperLimit    = UpperLimit;
            target.DamageCurve   = DamageCurve;
            target.Enemies       = Enemies;
        }
コード例 #8
0
        public List <SpecialComponent> GetPropertyList()
        {
            List <SpecialComponent> components       = new List <SpecialComponent>();
            SpecialComponent        currentComponent = itemProperties;

            if (currentComponent == null)
            {
                return(null);
            }

            components.Add(currentComponent);
            while (currentComponent.BaseComponent() != null)
            {
                currentComponent = currentComponent.BaseComponent();
                components.Add(currentComponent);
            }
            return(components);
        }
コード例 #9
0
        public override void Upgrade(SpecialComponent component)
        {
            var splashComponent = component as SplashDamageComponent;

            if (splashComponent == null)
            {
                Debug.LogWarning("Invalid component");
                return;
            }

            float newRadius = RadiusIncrease.Increase(splashComponent.SplashRadius, ValueToUse);

            if (splashComponent.HasUpperLimit)
            {
                splashComponent.SplashRadius = Math.Min(
                    newRadius,
                    splashComponent.UpperLimit);
            }
            else
            {
                splashComponent.SplashRadius = newRadius;
            }
        }
コード例 #10
0
        public SpecialComponent Decorate(SpecialComponent special)
        {
            SpecialComponent s;

            switch (type)
            {
            case SpecialType.ExtraHot:
                s = new SpecialExtraHot(special);
                return(s);

            case SpecialType.LittleOil:
                s = new SpecialLittleOil(special);
                return(s);

            case SpecialType.LittleSalt:
                s = new SpecialLittleSalt(special);
                return(s);

            case SpecialType.NoBeanSprouts:
                s = new SpecialNoBeansprouts(special);
                return(s);

            case SpecialType.NoChilli:
                s = new SpecialNoChilli(special);
                return(s);

            case SpecialType.NoMSG:
                s = new SpecialNoMSG(special);
                return(s);

            case SpecialType.NoOnions:
                s = new SpecialNoOnions(special);
                return(s);

            case SpecialType.NoPeanuts:
                s = new SpecialNoPeanuts(special);
                return(s);

            case SpecialType.NoPeas:
                s = new SpecialNoPeas(special);
                return(s);

            case SpecialType.NoPork:
                s = new SpecialNoPork(special);
                return(s);

            case SpecialType.NoShrimps:
                s = new SpecialNoShrimps(special);
                return(s);

            case SpecialType.LittleChilli:
                s = new SpecialLittleChilli(special);
                return(s);

            case SpecialType.NoVegetables:
                s = new SpecialNoVegetables(special);
                return(s);

            case SpecialType.NoWaterChestnuts:
                s = new SpecialNoWaterChestnuts(special);
                return(s);

            case SpecialType.SauceSeperate:
                s = new SpecialSauceSeperate(special);
                return(s);

            case SpecialType.Spicy:
                s = new SpecialSpicy(special);
                return(s);

            case SpecialType.ExtraPancakes:
                s = new SpecialExtraPancakes(special);
                return(s);

            case SpecialType.NoSalt:
                s = new SpecialNoSalt(special);
                return(s);

            default:
                return(special);
            }
        }
コード例 #11
0
 public void UpdateText(SpecialComponent special)
 {
     _text.color = special.SpecialType.UiColor;
     _text.text  = special.GetUiText();
 }