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); }
protected override SelectorNode CreateBehaviour() { //create the dig nodes CanDigNode canDigNode = new CanDigNode(this); HealthLessThanNode healthCheckNode = new HealthLessThanNode(this, 0.6f); AnimatorNode digAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsDigging", ref m_DigAnimationLink); ToggleParticleSystemNode toggleParticleNode = new ToggleParticleSystemNode(this, DigParticleSystem); DelegateNode.Delegate toggleTriggerFunc = SetColliderTrigger; DelegateNode toggleTriggerNode = new DelegateNode(this, toggleTriggerFunc, true); DelegateNode.Delegate toggleColliderFunc = ToggleCollider; DelegateNode toggleColliderNode = new DelegateNode(this, toggleColliderFunc); ToggleNavMeshAgentNode toggleAgentNode = new ToggleNavMeshAgentNode(this); DelayNode delayNode = new DelayNode(this, 2.0f); //TODO: COMMENT THIS SECTION AND ADD STRING PlaySoundNode digSFX = new PlaySoundNode(this, "NergDig"); LerpNode lerpDownNode = new LerpNode(this, Vector3.down, 1.0f, 2.0f, 10.0f); DelegateNode.Delegate rotateFunc = RotateVertical; DelegateNode rotateNode = new DelegateNode(this, rotateFunc); TeleportToTargetOffsetNode teleportNode = new TeleportToTargetOffsetNode(this, new Vector3(0.0f, -5.0f, 0.0f)); LerpToTargetNode lerpToTargetNode = new LerpToTargetNode(this, 0.5f, 1.0f, 10.0f); AnimatorNode biteAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsBiting", ref m_BiteAnimationLink); RunUntillTargetNull targetNullNode = new RunUntillTargetNull(this); //create the dig sequence SequenceNode digSequence = new SequenceNode(this, "DigSequence", healthCheckNode, canDigNode, toggleParticleNode, toggleTriggerNode, toggleColliderNode, toggleAgentNode, delayNode, digSFX, lerpDownNode, toggleParticleNode, rotateNode, teleportNode, toggleColliderNode, toggleParticleNode, lerpToTargetNode, digSFX, delayNode, toggleParticleNode, targetNullNode ); //create the targeting nodes TargetingSightNode sightNode = new TargetingSightNode(this, 1); TargetingLowHealthNode lowHealth = new TargetingLowHealthNode(this, 3); CalculateTargetNode calcTarget = new CalculateTargetNode(this); //assign the targeting sequence SequenceNode targetingSequ = new SequenceNode(this, "TargetingSequence", sightNode, lowHealth, calcTarget); //create the spit nodes CooldownNode spitCooldownNode = new CooldownNode(this, 1.0f); //AnimatorNode spitAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsSpitting", ref m_SpitAnimationLink); ShootProjectileNode projectileNode = new ShootProjectileNode(this, 1, ProjectilePrefab, ProjectileSpawnLoc, "MasterNergProjectile", 10); //SFX for the sound of the nerg spitting PlaySoundNode spitSound = new PlaySoundNode(this, "NergSpit"); //create the movement nodes CooldownNode movementCooldownNode = new CooldownNode(this, 3.0f); //BackAwayNode backAwayNode = new BackAwayNode(this, false, 1.0f); SideStepNode sideStepNode = new SideStepNode(this, false, 2.0f); PredictiveAvoidanceNode predictMovementNode = new PredictiveAvoidanceNode(this, false, true, 2.0f, 5.0f); MovementOptionRandomNode movementNodes = new MovementOptionRandomNode(this, sideStepNode, predictMovementNode); //SFX for the sound of the nerg moving backward //TODO: COMMENT THIS SECTION AND ADD STRING //PlaySoundNode crawlingSFX = new PlaySoundNode(this,); //create the spit sequence SequenceNode spitSequence = new SequenceNode(this, "SpitSequence", spitCooldownNode, projectileNode, spitSound, movementCooldownNode, movementNodes /*, crawlingSFX*/); //assign the attack selector SelectorNode attackSelector = new SelectorNode(this, "AttackSelector", digSequence, spitSequence); //create the attack sequence SequenceNode attackSequence = new SequenceNode(this, "AttackTargetSequence", targetingSequ, attackSelector); //create utility selector SelectorNode utilitySelector = new SelectorNode(this, "UtilitySelector", attackSequence); return(utilitySelector); }