Beispiel #1
0
        /// <summary>
        /// This function sets up a basic attack: adopt a given stance, and then attack.
        /// </summary>
        /// <param name="newTask">The starting stance</param>
        protected void StrikeSequence(OpponentStances.Stances newStance)
        {
            startStance = newStance;

            AdoptStanceTask stanceTask = new AdoptStanceTask(newStance, this);

            stanceTask.Then(new StrikeTask(this));

            Services.Tasks.AddTask(stanceTask);
        }
Beispiel #2
0
        /// <summary>
        /// This function has the opponent pull their sword back to the position it was in when they started the attack.
        /// </summary>
        /// <param name="e">A SwordContactEvent</param>
        protected override void WithdrawSequence(global::Event e)
        {
            Debug.Assert(e.GetType() == typeof(SwordContactEvent), "Non-SwordContactEvent in WithdrawSequence().");

            SwordContactEvent contactEvent = e as SwordContactEvent;

            //make sure the contacting sword is this opponent's sword, not the player's sword, etc.
            if (contactEvent.rb.transform.parent.gameObject.name == opponentObjName)
            {
                AdoptStanceTask withdrawTask = new AdoptStanceTask(startStance, this);
                withdrawTask.Then(new AdoptStanceTask(OpponentStances.Stances.Neutral, this));
                Services.Tasks.AddTaskExclusive(withdrawTask);
            }
        }