Exemple #1
0
        public IValue GetState(Address address)
        {
            AddressStateMap states = _blocks.GetState(address);

            states.TryGetValue(address, out var value);
            return(value);
        }
Exemple #2
0
        public object GetState(Address address)
        {
            AddressStateMap states = _blocks.GetStates(new[] { address });

            states.TryGetValue(address, out object value);
            return(value);
        }
Exemple #3
0
        public override AddressStateMap Execute(Address from, Address to, AddressStateMap states)
        {
            var result = new BattleResult();

            if (states.TryGetValue(to, out object value))
            {
                var previousResult = (BattleResult)value;
                result.UsedWeapons = previousResult.UsedWeapons;
                result.Targets     = previousResult.Targets;
            }

            result.UsedWeapons.Add(Weapon);
            result.Targets.Add(Target);

            return((AddressStateMap)states.SetItem(to, result));
        }
Exemple #4
0
        public override AddressStateMap Execute(IActionContext context)
        {
            var             result         = new BattleResult();
            AddressStateMap previousStates = context.PreviousStates;
            Address         to             = context.To;

            if (previousStates.TryGetValue(to, out object value))
            {
                var previousResult = (BattleResult)value;
                result.UsedWeapons = previousResult.UsedWeapons;
                result.Targets     = previousResult.Targets;
            }

            result.UsedWeapons.Add(Weapon);
            result.Targets.Add(Target);

            return((AddressStateMap)previousStates.SetItem(to, result));
        }