public override void UseSkill()
    {
        //Store the index of the current selections so that we can refer back to it later when the channel finishes (or triggers in some way)
        nSelectionsInputIndex = NetworkMatchReceiver.Get().indexCurMatchInput;

        ContSkillEngine.PushSingleClause(new ClauseBeginChannel(skill));
    }
    public void HandleFastForwarding()
    {
        //Check if we have a stacked up number of stored inputs that we need to plow through

        if (NetworkMatchReceiver.Get().HasNReadyInputs(nFASTFORWARDTHRESHOLD))
        {
            ContTime.Get().SetAutoFastForward(true);
        }
        else
        {
            ContTime.Get().SetAutoFastForward(false);
        }
    }
    //Fetch the current selection information passed to us from the Master
    public virtual InputSkillSelection GetUsedSelections() {

        InputSkillSelection selections = (InputSkillSelection)NetworkMatchReceiver.Get().GetCurMatchInput();

        //You can only get legitimate selections for this skill if the selection passed is referring to
        //  this skill
        Debug.Assert(selections != null, "ERROR - Master has passed no selectionsFromMaster at this point");

        Debug.Assert(ContTurns.Get().GetNextActingChr() == skill.chrOwner, "ERROR - The acting character isn't the owner of this skill");

        Debug.Assert(selections.skillslotSelected.skill == skill, "ERROR - The selected skill from the player does not match this skill");

        return selections;

    }
Beispiel #4
0
    //Use the selected skill with the supplied targets
    public void UseSkill()
    {
        if (NetworkMatchReceiver.Get().IsCurMatchInputReady() == false)
        {
            Debug.LogError("Tried to use skill, but we don't have the current input ready yet (input " + NetworkMatchReceiver.Get().indexCurMatchInput);
        }

        if (CanSelect((InputSkillSelection)NetworkMatchReceiver.Get().GetCurMatchInput()) == false)
        {
            Debug.LogError("Tried to use skill, but the master-provided selections were invalid! : " + NetworkMatchReceiver.Get().GetCurMatchInput().ToString());
        }

        // IMPORTANT - since we're pushing these effects onto the stack, we'll want to
        //             push them in reverse order so that we will evaluate the most recently pushed effect first



        //Finally, add an ending marker after the skill is executed
        PushEndingMarker();

        //Let the type of this skill dictate the behaviour and push all relevant effects onto the stack
        typeUsage.UseSkill();

        //Then, add a starting marker before the skills' effects
        PushStartingMarker();

        //Fourth, pay the cooldown
        PayCooldown();

        //Third, pay the fatigue
        PayFatigue();

        //Second pay the mana cost for the skill
        PayManaCost();

        //First pay the skill points
        PaySkillPoints();
    }
    //The main loop that will process the effects of the game.  If it needs inputs, it will flag what
    //  it's waiting on and pull input from the network buffer to decide what action should be taken
    public IEnumerator CRMatchLoop()
    {
        //Do any animation processing that needs to be done before the match processing actually starts
        yield return(StartCoroutine(CRPrepMatch()));

        //Initially decide if we want to do any fast forwarding from early loaded input
        HandleFastForwarding();

        //Do any initial processing for beginning of match effects
        yield return(ProcessStackUntilInputNeeded());

        //Keep processing effects while the match isn't finished
        while (!IsMatchOver())
        {
            // At this point, we should have an input field that's been set up that needs to be filled out
            Debug.Assert(matchinputToFillOut != null);

            bool bNeedsLocalInput = false;

            //If we need input, let's check if we already have input waiting in our buffer for that input
            if (NetworkMatchReceiver.Get().IsCurMatchInputReady() == false)
            {
                // Now that input is needed by some player, check if we locally control that player
                if (NetworkMatchSetup.IsLocallyOwned(matchinputToFillOut.iPlayerActing))
                {
                    bNeedsLocalInput = true;
                    //Let the match input prepare to start gathering manual input
                    matchinputToFillOut.StartManualInputProcess();
                }
                else
                {
                    //If we don't locally control the player who needs to decide an input
                    DebugDisplay.Get().SetDebugText("Waiting for foreign input");
                }

                //Wait until we have input waiting for us in the network buffer
                while (NetworkMatchReceiver.Get().IsCurMatchInputReady() == false)
                {
                    //Keep spinning until we get the input we're waiting on

                    DebugDisplay.Get().SetDebugText("Waiting for input");
                    yield return(null);
                }

                //Do any cleanup that we need to do if we were waiting on input
                //TODO - figure out what needs to be done and under what circumstances - careful of potentially changing local input controllers
                if (bNeedsLocalInput == true)
                {
                    //Have the match input let the local input controller know that we're done with gathering input
                    matchinputToFillOut.EndManualInputProcess();
                }
            }

            //Check if we should be master forwarding through our inputs if we have a bunch stacked up waiting to be processed (like from loading a log file or reconnecting)
            HandleFastForwarding();

            //At this point, we have an input in the buffer that we are able to process
            MatchInput matchinput = NetworkMatchReceiver.Get().GetCurMatchInput();

            //Make a record of which input we're going to be processing in our logs
            LogManager.Get().LogMatchInput(matchinput);

            //Clear out the matchinput we prompting to be filled out
            matchinputToFillOut = null;

            //Process that match input by deferring to its execute method
            yield return(matchinput.Execute());

            //The execute method should have pushed new executables/clauses onto the stack, so we can process them
            // Pass control over to the stack-processing loop until it needs player input to continue the simulation
            yield return(ProcessStackUntilInputNeeded());

            //Since we're done processing all the effects that may need access to the most recent input, we can advance to the next needed input
            NetworkMatchReceiver.Get().FinishCurMatchInput();
        }

        //Do any animation process that needs to be done before we leave the match scene
        yield return(StartCoroutine(CRCleanUpMatch()));

        //Do any fill wrap-up for the match
        FinishMatch();
    }
 public override InputSkillSelection GetUsedSelections()
 {
     return((InputSkillSelection)NetworkMatchReceiver.Get().lstMatchInputBuffer[nSelectionsInputIndex]);
 }
Beispiel #7
0
 //Send the input for the current input that we have processed up to (according to the networkreceiver)
 public void SendNextInput(MatchInput matchinputToSend)
 {
     SendInput(NetworkMatchReceiver.Get().indexCurMatchInput, matchinputToSend);
 }