Exemple #1
0
        protected override SelectorNode CreateBehaviour()
        {
            #region Spectral Chain Sequence
            //being section that deals with the attack
            #region Create the sequence for attacking
            //when ere begins to move to the center of the map she does it through this node
            AgentMoveToLocationNode moveToLocation = new AgentMoveToLocationNode(this, m_RoomCenter.position);
            //When ere's animation of her raising the chain happens
            AnimatorNode chainRaiseNode = new AnimatorNode(this, m_AnimatorRef, "IsChainRaising", ref m_SpearRaiseLink);
            //the chain move to player node which will move the chain to the player
            ChainMoveToPlayersNode chainMoveToPlayer = new ChainMoveToPlayersNode(this, SpearTipLocation, m_LineRenderer, ChainTravelTime);
            //this node determines if the chain attack is done
            HasChainReturnedNode hasChainReturned = new HasChainReturnedNode(this);
            AnimatorNode         chainLowerNode   = new AnimatorNode(this, m_AnimatorRef, "IsChainLowering", ref m_SpearLowerLink);
            PlaySoundNode        ChainSoundNode   = new PlaySoundNode(this, "ChainSound");


            //tieing all the nodes into the sequence

            SequenceNode chainAttackSection = new SequenceNode(this, "Spectral Chain Attack", moveToLocation, chainRaiseNode, chainMoveToPlayer, hasChainReturned, chainLowerNode);
            #endregion

            #region Target Selection region
            //determines if to much time has passed away from center of the map
            TimeAwayFromCenterNode timeAwayFromCenter = new TimeAwayFromCenterNode(this, m_RoomCenter.position, CenterMapSafeSpace, MaxWaitTimeAwayFromCenter);
            //determines the player's distance from Inanna
            PlayerToCloseTargetNode playerToCloseToTargetNode = new PlayerToCloseTargetNode(this, m_Inanna.transform, MinimumDistanceToTarget);

            SelectorNode spectralChainAttackSelector = new SelectorNode(this, "Choose Attack Selector Spectral Chain", timeAwayFromCenter, playerToCloseToTargetNode);
            #endregion
            //cooldown node for spectral chain
            CooldownNode spectralChainCooldown = new CooldownNode(this, SpectralChainCooldown);
            //determines if Ere can still use chain attack
            CanUseChainsNode canUseChain = new CanUseChainsNode(this, MaxChainCyclesPerCycle);


            SequenceNode specrtalChainSequence = new SequenceNode(this, "Spectral Chain Sequence", spectralChainCooldown, canUseChain, spectralChainAttackSelector, ChainSoundNode, chainAttackSection);
            #endregion

            #region Ereshkigal Attack Sequence

            #region Target Selector
            #region Protecting Inanna Sequence
            //puts points into anyone to far away from Ere
            TargetingDistanceFromLocationGreaterThenNode distanceFromEre = new TargetingDistanceFromLocationGreaterThenNode(this, transform, EreshkigalSafeSpace, 1);
            //puts points into anyone to close to Anna
            TargetingDistanceFromLocationNode distanceFromAnna = new TargetingDistanceFromLocationNode(this, m_Inanna.transform, MinimumDistanceToTarget, 2);
            CalculateTargetNode calcTarget = new CalculateTargetNode(this);
            SequenceNode        protectingInannaSequence = new SequenceNode(this, "Protecting Inanna Sequence", distanceFromEre, distanceFromAnna, calcTarget);
            #endregion

            TargetFollowUp   followup         = new TargetFollowUp(this);
            TargetSwitchNode switchTargetNode = new TargetSwitchNode(this);

            SelectorNode targetingSelector = new SelectorNode(this, "Taregting Selector", protectingInannaSequence, followup, switchTargetNode);
            #endregion

            #region Lunge Attack
            CooldownNode           lungeCooldown  = new CooldownNode(this, LungeCooldown);
            ToggleNavMeshAgentNode toggleAgentOff = new ToggleNavMeshAgentNode(this);
            //the crouch before the big jump animator node
            AnimatorNode preJump = new AnimatorNode(this, m_AnimatorRef, "IsPreJumping", ref m_PreJumpLink);
            //lerp and animation which will run in tandum
            LerpNode       jumpLerp            = new LerpNode(this, Vector3.up, 1.0f, JumpHeight, JumpSpeed);
            AnimatorNode   fulljump            = new AnimatorNode(this, m_AnimatorRef, "IsFullJumping", ref m_JumpLink);
            RunUntilSuceed runJumpAndAnimation = new RunUntilSuceed(this, "Run Animation and Jump", fulljump, jumpLerp);
            PlaySoundNode  LungeSoundNode      = new PlaySoundNode(this, "HeavyAttack2");
            PlaySoundNode  JumpSoundNode       = new PlaySoundNode(this, "WingFlap");
            PlaySoundNode  ScreamSoundNode     = new PlaySoundNode(this, "EreshkigalScream");



            AnimatorNode            jumpIdle         = new AnimatorNode(this, m_AnimatorRef, "IsJumpIdle", ref m_JumpIdleLink);
            LookAtTargetNode        lookAtTarget     = new LookAtTargetNode(this);
            ToggleMeleeColliderNode toggleLungeOn    = new ToggleMeleeColliderNode(this, SpearCollider, LungeDamage);
            AnimatorNode            diveAnimation    = new AnimatorNode(this, m_AnimatorRef, "IsDiving", ref m_DiveLink);
            LerpToTargetNode        diveLerp         = new LerpToTargetNode(this, DiveTime, JumpHeight, DiveSpeed);
            RunUntilSuceed          diveAtPlayer     = new RunUntilSuceed(this, "Run Dive and Animation", diveAnimation, diveLerp);
            ToggleMeleeColliderNode toggleLungeOff   = new ToggleMeleeColliderNode(this, SpearCollider, 0);
            ToggleNavMeshAgentNode  toggleAgentOn    = new ToggleNavMeshAgentNode(this);
            AnimatorNode            diveRecoveryNode = new AnimatorNode(this, m_AnimatorRef, "IsInDiveRecovery", ref m_DiveRecoverLink);

            SequenceNode lungeAttackSequence = new SequenceNode(this, "Lunge Attack Sequence",
                                                                lungeCooldown,
                                                                toggleAgentOff,
                                                                preJump,
                                                                runJumpAndAnimation,
                                                                JumpSoundNode,
                                                                jumpIdle,
                                                                toggleLungeOn,
                                                                lookAtTarget,
                                                                ScreamSoundNode,
                                                                diveAtPlayer,
                                                                JumpSoundNode,
                                                                toggleLungeOff,
                                                                toggleAgentOn,
                                                                diveRecoveryNode);
            #endregion

            #region Spear Toss Attack
            CooldownNode        spearTossCooldown          = new CooldownNode(this, SpearThrowCooldown);
            AnimatorNode        spearThrowAnimator         = new AnimatorNode(this, m_AnimatorRef, "IsSpearBeingThrow", ref m_SpearThrowLink);
            ShootProjectileNode spearProjectileShoot       = new ShootProjectileNode(this, SpearThrowDamage, SpearProjectilePrefab, SpearThrowLocation.gameObject, "SpearProjectile", 2);
            AnimatorNode        spearThrowRecoveryAnimator = new AnimatorNode(this, m_AnimatorRef, "IsInSpearRecovery", ref m_SpearThrowRecoveryLink);

            SequenceNode spearTossSequence = new SequenceNode(this, "Spear Toss Sequence", spearTossCooldown, spearThrowAnimator, spearProjectileShoot, LungeSoundNode, spearThrowRecoveryAnimator);
            #endregion

            #region Basic Attack Selector

            #region 360 Attack
            CheckDistanceToTargetNode attack360DistanceCheck = new CheckDistanceToTargetNode(this, Agent.stoppingDistance);
            AnimatorNode            buildUp360           = new AnimatorNode(this, m_AnimatorRef, "IsIn360BuildUp", ref m_360BuildUpLink);
            ToggleMeleeColliderNode toggleOn360Collider  = new ToggleMeleeColliderNode(this, SpearCollider, SpearAttack360Damage);
            AnimatorNode            swing360             = new AnimatorNode(this, m_AnimatorRef, "IsIn360Swing", ref m_360SwingLink);
            ToggleMeleeColliderNode toggleOff360Collider = new ToggleMeleeColliderNode(this, SpearCollider, 0);
            AnimatorNode            recovery360          = new AnimatorNode(this, m_AnimatorRef, "IsIn360Recovery", ref m_360RecoveryLink);

            SequenceNode sequence360Attack = new SequenceNode(this, "360 Attack Sequence", attack360DistanceCheck, buildUp360, toggleOn360Collider, swing360, LungeSoundNode, toggleOff360Collider, recovery360);
            #endregion

            #region Upper Stab
            PlaySoundNode             MedThrustSound           = new PlaySoundNode(this, "MedAttack3");
            CheckDistanceToTargetNode attackUpperStab          = new CheckDistanceToTargetNode(this, Agent.stoppingDistance);
            AnimatorNode            buildUpUpperStab           = new AnimatorNode(this, m_AnimatorRef, "IsInUpperStabBuildUp", ref m_UpperStabBuildUpLink);
            ToggleMeleeColliderNode toggleOnUpperStabCollider  = new ToggleMeleeColliderNode(this, SpearCollider, SpearAttackUpperStabDamage);
            AnimatorNode            swingUpperStab             = new AnimatorNode(this, m_AnimatorRef, "IsInUpperStabSwing", ref m_UpperStabSwingLink);
            ToggleMeleeColliderNode toggleOffUpperStabCollider = new ToggleMeleeColliderNode(this, SpearCollider, 0);
            AnimatorNode            recoveryUpperStab          = new AnimatorNode(this, m_AnimatorRef, "IsInUpperStabRecovery", ref m_UpperStabRecoveryLink);

            SequenceNode sequenceUpperStabAttack = new SequenceNode(this, "Upper Stab Sequence", attackUpperStab, buildUpUpperStab, toggleOnUpperStabCollider, swingUpperStab, MedThrustSound, toggleOffUpperStabCollider, recoveryUpperStab);
            #endregion

            #region Jab
            PlaySoundNode             PlayLightThrustSound   = new PlaySoundNode(this, "LightAttack2");
            CheckDistanceToTargetNode attackJabDistanceCheck = new CheckDistanceToTargetNode(this, Agent.stoppingDistance);
            AnimatorNode            buildUpJab           = new AnimatorNode(this, m_AnimatorRef, "IsInJabBuildUp", ref m_JabBuildUpLink);
            ToggleMeleeColliderNode toggleOnJabCollider  = new ToggleMeleeColliderNode(this, SpearCollider, SpearAttackJabDamage);
            AnimatorNode            swingJab             = new AnimatorNode(this, m_AnimatorRef, "IsInJabSwing", ref m_JabSwingLink);
            ToggleMeleeColliderNode toggleOffJabCollider = new ToggleMeleeColliderNode(this, SpearCollider, 0);
            AnimatorNode            recoveryJab          = new AnimatorNode(this, m_AnimatorRef, "IsInJabRecovery", ref m_JabRecoveryLink);

            SequenceNode sequenceJabAttack = new SequenceNode(this, "Jab Attack Sequence", attackJabDistanceCheck, buildUpJab, toggleOnJabCollider, swingJab, PlayLightThrustSound, toggleOffJabCollider, recoveryJab);
            #endregion

            ChooseRandomChildNode randomBasicAttackSelector = new ChooseRandomChildNode(this, "Basic Attack Selector, Random", sequence360Attack, sequenceJabAttack, sequenceUpperStabAttack);
            #endregion

            ApproachNode approachTargetPlayer     = new ApproachNode(this);
            SelectorNode chooseAttackSelector     = new SelectorNode(this, "Attack Choosing Selector", lungeAttackSequence, spearTossSequence, randomBasicAttackSelector, approachTargetPlayer);
            SequenceNode ereshkigalAttackSequence = new SequenceNode(this, "Ereshkigal Basic Attack Sequence", targetingSelector, chooseAttackSelector);
            #endregion

            SelectorNode utilitySelector = new SelectorNode(this, "UtilitySelector", specrtalChainSequence, ereshkigalAttackSequence);

            return(utilitySelector);
        }
Exemple #2
0
        protected override SelectorNode CreateBehaviour()
        {
            //Create melee attack nodes

            //Create ground slam nodes
            CooldownNode   groundSlamCooldownNode       = new CooldownNode(this, GroundSlamCooldownTime);
            AnimatorNode   groundSlamStartAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsGroundSlamStarting", ref m_GroundSlamStartLink);
            GroundSlamNode groundSlamNode = new GroundSlamNode(this, FallingRockPrefab, PunchHitBox.transform);

            //TODO: COMMENT THIS SECTION AND ADD STRING
            PlaySoundNode slamSFX = new PlaySoundNode(this, "GolemGroundSlamImpact");
            AnimatorNode  groundSlamRecoveryAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsGroundSlamRecovering", ref m_GroundSlamRecoveryLink);

            ToggleParticleSystemNode toggleGroundSlamPartclesNode = new ToggleParticleSystemNode(this, SlamParticleSystem);

            //Create ground slam sequence
            SequenceNode groundSlamSequence = new SequenceNode(this, "GroundSlamSequence", groundSlamCooldownNode, groundSlamStartAnimationNode, groundSlamNode, toggleGroundSlamPartclesNode, slamSFX, groundSlamRecoveryAnimationNode);

            //Create punch nodes
            CheckDistanceToTargetNode punchDistanceNode = new CheckDistanceToTargetNode(this, 5.0f);

            ToggleMeleeColliderNode togglePunchNode = new ToggleMeleeColliderNode(this, PunchHitBox, 15);

            LookAtTargetNode lookAtTargetNode   = new LookAtTargetNode(this);
            AnimatorNode     punchAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsPunching", ref m_PunchLink);
            //TODO: COMMENT THIS SECTION AND ADD STRING
            PlaySoundNode punchSFX = new PlaySoundNode(this, "GolemPunchImpact");
            //Create punch sequence
            SequenceNode punchSequence = new SequenceNode(this, "PunchSequence", punchDistanceNode, togglePunchNode, lookAtTargetNode, punchSFX, punchAnimationNode, togglePunchNode);

            //Create melee attack selector in order: GroundSlam, Punch
            SelectorNode meleeAttackSelector = new SelectorNode(this, "MeleeAttackSelector");

            meleeAttackSelector.AddChildren(groundSlamSequence, punchSequence);

            //Create ranged attack nodes

            //Create rock throw nodes
            CooldownNode rockThrowCooldownNode       = new CooldownNode(this, 10.0f);
            AnimatorNode rockThrowStartAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsRockThrowStarting", ref m_RockThrowStartLink);
            //TODO: COMMENT THIS SECTION AND ADD STRING
            PlaySoundNode rockThrowSFX = new PlaySoundNode(this, "GolemRockThrow");

            DelegateNode.Delegate setRockMeshFunc     = SetRockMesh;
            DelegateNode          setRockMeshTrueNode = new DelegateNode(this, setRockMeshFunc, true);

            AnimatorNode  rockThrowingAnimationNode      = new AnimatorNode(this, m_AnimatorRef, "IsRockThrowing", ref m_RockThrowingLink);
            DelegateNode  setRockMeshFalseNode           = new DelegateNode(this, setRockMeshFunc, false);
            RockThrowNode rockThrowNode                  = new RockThrowNode(this, RockThrowPrefab, FireLocation, RockThrowDamage);
            AnimatorNode  rockThrowRecoveryAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsRockThrowRecovering", ref m_RockThrowRecoveryLink);

            //Create rock throw sequence
            SequenceNode rockThrowSequence = new SequenceNode(this, "RockThrowSequence", rockThrowCooldownNode,
                                                              rockThrowStartAnimationNode,
                                                              setRockMeshTrueNode,
                                                              rockThrowingAnimationNode,
                                                              setRockMeshFalseNode,
                                                              rockThrowNode,
                                                              rockThrowSFX,
                                                              rockThrowRecoveryAnimationNode
                                                              );

            //Create ground spike nodes
            CooldownNode     groundSpikesCooldownNode       = new CooldownNode(this, 10.0f);
            AnimatorNode     groundSpikesStartAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsGroundSpikeStarting", ref m_GroundSpikesStartLink);
            GroundSpikesNode groundSpikesNode = new GroundSpikesNode(this, SpikePrefab, SpikesMovementTime);
            AnimatorNode     groundSpikesRecoveryAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsGroundSpikesRecovering", ref m_GroundSpikesRecoveryLink);

            //Create ground spike sequence
            SequenceNode groundSpikesSequence = new SequenceNode(this, "GroundSpikesSequence", groundSpikesCooldownNode, groundSpikesStartAnimationNode, groundSpikesNode, groundSpikesRecoveryAnimationNode);

            //Create ranged attack selector in order: RockThrow, GroundSpikes
            SelectorNode rangedAttackSelector = new SelectorNode(this, "RangedAttackSelector");

            rangedAttackSelector.AddChildren(rockThrowSequence, groundSpikesSequence);

            //Create targeting nodes
            TargetingAfflicted         targetingAfflictedNode     = new TargetingAfflicted(this, 8, Status.Stun);
            TargetingDistanceNode      targetingDistanceNode      = new TargetingDistanceNode(this, 1);
            TargetingHighHealthNode    targetingHighHealthNode    = new TargetingHighHealthNode(this, 1);
            TargetingHighestDamageNode targetingHighestDamageNode = new TargetingHighestDamageNode(this, 1);
            TargetingCharacterType     targetingCharacterType     = new TargetingCharacterType(this, 1, WeaponType.RANGED);
            CalculateTargetNode        calculateTargetNode        = new CalculateTargetNode(this);

            //Create the targeting sequence and attach nodes
            SequenceNode targetingSequence = new SequenceNode(this, "TargetingSequence");

            targetingSequence.AddChildren(targetingAfflictedNode,
                                          targetingDistanceNode,
                                          targetingHighHealthNode,
                                          targetingHighestDamageNode,
                                          targetingCharacterType,
                                          calculateTargetNode);

            //Create approach node
            ApproachNode approachNode = new ApproachNode(this);

            //Create Abilities/Melee/Ranged/Approach Selector
            SelectorNode actionSelector = new SelectorNode(this, "ActionSelector");

            actionSelector.AddChildren(meleeAttackSelector, rangedAttackSelector, approachNode);

            //Create Target->Action sequence
            SequenceNode getTargetAndUseAbilitySequence = new SequenceNode(this, "GetTargetAndUseAbilitySequence");

            getTargetAndUseAbilitySequence.AddChildren(targetingSequence, actionSelector);

            //Create the utility selector with the previous sequence and approach node
            SelectorNode utilitySelector = new SelectorNode(this, "UtilitySelector");

            utilitySelector.AddChildren(getTargetAndUseAbilitySequence);

            return(utilitySelector);
        }