コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (state == CombatState.TIMER)
        {
            TimerPhase();
        }
        else if (state == CombatState.ATTACK)
        {
            CombatPhase();
        }
        else if (state == CombatState.NULL)
        {
            if (Input.GetButtonUp("Jump"))
            {
                InitializeCombat();
            }
        }
        else if (state == CombatState.ANIM)
        {
            AnimatePhase();
        }

        Debug.Log(state.ToString());
        _ct.time  = timer;
        _ct.timer = countdownTime;
    }
コード例 #2
0
 public void UseCurrentActionActorEffects(CombatState combatState)
 {
     Debug.Log("USECURRENTACTIONACTOREFFECTS: " + combatState.ToString());
     //We begin calculating the abilities speed
     this.combatState = combatState;
     //Place effects that fire in the current state into the EffectsInPlay list
     ActivateEffects(currentAction);
     //Sort the list by resolution order
     SortEffectsInPlay(); //TODO
     //Resolve the list
     ResolveEffectsInPlay();
 }
コード例 #3
0
        private void ChangeState(CombatState newState)
        {
            CombatState oldState = _sessionModel.State.Value;

            if (!AllowedTransitions.TryGetValue(
                    oldState, out HashSet <CombatState> possibleStates) ||
                !possibleStates.Contains(newState))
            {
                Debug.Log(
                    $"Attempted forbidden transition: {oldState.ToString()} to {newState.ToString()}");
                return;
            }

            _sessionModel.State.Value = newState;
        }
コード例 #4
0
        private static void TestSerialization()
        {
            var state = new CombatState("TestCombat", 1);

            state.Combatants.Add(new CombatStateTracker.Combatants.Combatant()
            {
                Name = "Ork", Wounds = 12, WoundsMax = 12
            });
            state.Combatants.Add(new CombatStateTracker.Combatants.Combatant()
            {
                Name = "Guardsman", Wounds = 7, WoundsMax = 7
            });
            Console.WriteLine($"Serializing state: \n{state.ToString()}");
            CombatStateSerializer.SerializeToXml(state);
            Console.WriteLine("Success!");
            string fileName = "TestCombat_1.xml";

            Console.WriteLine($"Deserializing {fileName}...");
            var stateReload = CombatStateSerializer.DeserializeFromXml(fileName);

            Console.WriteLine($"Success! Deserialized State: \n{stateReload.ToString()}.");
        }