protected override SelectorNode CreateBehaviour() { //create attack nodes KamikazeNode kamikazeNode = new KamikazeNode(this); GustNode gustNode = new GustNode(this, DebrisPrefab); SwoopNode swoopNode = new SwoopNode(this); //create the flyabove node FlyAboveTargetNode flyAboveTargetNode = new FlyAboveTargetNode(this); //create the attack selector and attach the above nodes in the following sequence : KamakaziNode, GustNode, SwoopNode, FlyAboveTargetNode SelectorNode attackSelector = new SelectorNode(this, "AttackSelector"); attackSelector.AddChildren(kamikazeNode, gustNode, swoopNode, flyAboveTargetNode); //create the targeting nodes TargetingDistanceNode targetingDistanceNode = new TargetingDistanceNode(this, 1); TargetingLowHealthNode targetingLowHealthNode = new TargetingLowHealthNode(this, 1); TargetingHighestDamageNode targetingHighestDamageNode = new TargetingHighestDamageNode(this, 1); TargetingCharacterType targetingCharacterType = new TargetingCharacterType(this, 1, WeaponType.MELEE); CalculateTargetNode calculateTargetNode = new CalculateTargetNode(this); //create the targeting logic from the above nodes. The order is as follows: SequenceNode targetingSequence = new SequenceNode(this, "TargetingSequence"); targetingSequence.AddChildren(targetingDistanceNode, targetingLowHealthNode, targetingHighestDamageNode, targetingCharacterType, calculateTargetNode); //create the sequence for having a target behaviour (ie attacking, flying above players) SequenceNode attackSequence = new SequenceNode(this, "GetTargetAndAttack"); attackSequence.AddChildren(targetingSequence, attackSelector); //create the utility selector and return it SelectorNode utilitySelector = new SelectorNode(this, "UtilitySelector"); utilitySelector.AddChildren(attackSequence); return(utilitySelector); }
protected override SelectorNode CreateBehaviour() { //Create the reposition nodes SafetyCheckNode safetyCheckNode = new SafetyCheckNode(this); DelegateNode.Delegate invincibleFunc = SetInvincible; DelegateNode setInvincibleTrueNode = new DelegateNode(this, invincibleFunc, true); AnimatorNode jumpAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsInannaJumping", ref m_JumpLink); LerpNode lerpUpwardsNode = new LerpNode(this, Vector3.up, JumpToMaxTime, JumpHeight, JumpSpeed); //Grab all tower points in the map GameObject[] towerPointGameObjects = GameObject.FindGameObjectsWithTag("TowerPoint"); Transform[] towerPointTransforms = new Transform[towerPointGameObjects.Length]; for (int i = 0; i < towerPointTransforms.Length; i++) { towerPointTransforms[i] = towerPointGameObjects[i].transform; } InannaMoveTowerNode moveTowerNode = new InannaMoveTowerNode(this, towerPointTransforms); LerpNode lerpDownwardsNode = new LerpNode(this, Vector3.down, JumpToMaxTime, JumpHeight, JumpSpeed); AnimatorNode landAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsInannaLanding", ref m_LandingLink); PlaySoundNode InnanaJumpSoundNode = new PlaySoundNode(this, "WingFlap"); DelegateNode setInvincibleFalseNode = new DelegateNode(this, invincibleFunc, false); //Create reposition sequence SequenceNode repositionSequence = new SequenceNode(this, "RepositionSequence", safetyCheckNode, setInvincibleTrueNode, jumpAnimationNode, InnanaJumpSoundNode, lerpUpwardsNode, moveTowerNode, lerpDownwardsNode, InnanaJumpSoundNode, landAnimationNode, setInvincibleFalseNode); //Create arrow rain nodes PlaySoundNode ArrowRainSound = new PlaySoundNode(this, "ArrowRain", 8.0f); RainOfArrowsCooldownNode arrowRainCooldownNode = new RainOfArrowsCooldownNode(this, RainOfArrowsCooldown, RainOfArrowsDiameter); RainOfArrowsTargetingNode arrowRainTargetNode = new RainOfArrowsTargetingNode(this, RainOfArrowsDiameter); AnimatorNode arrowRainAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsFiringRainOfArrows", ref m_ArrowRainShotLink); RainOfArrowsAttackNode arrowRainAttackNode = new RainOfArrowsAttackNode(this, m_CircularAOEPrefab.GetComponent <CircularAOE>(), RainOfArrowsWaitTime); //Create arrow rain sequence SequenceNode arrowRainSequence = new SequenceNode(this, "RainOfArrowsSequence", arrowRainCooldownNode, arrowRainTargetNode, arrowRainAnimationNode, arrowRainAttackNode, ArrowRainSound); //Create snipe shot nodes PlaySoundNode HeavyShotSound = new PlaySoundNode(this, "HeavyShot"); SnipeDelayNode snipeDelayNode = new SnipeDelayNode(this, m_Ereshkigal.transform, m_LineRenderer, m_Ereshkigal.EreshkigalSafeSpace, HitScanBuildUp); AnimatorNode snipeAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsSniping", ref m_SnipeShotLink); HitScanShotNode hitScanShotNode = new HitScanShotNode(this, ShootLocation.transform, m_HitScanShot, HitscanShotDamage, HitScanShotDelay); //Create snipe sequence SequenceNode snipeSequence = new SequenceNode(this, "SnipeSequence", snipeDelayNode, snipeAnimationNode, hitScanShotNode, HeavyShotSound); //Create arrow shot targeting nodes TargetingDistanceFromLocationGreaterThenNode targetingDistanceNode = new TargetingDistanceFromLocationGreaterThenNode(this, m_Ereshkigal.transform, m_Ereshkigal.EreshkigalSafeSpace * 0.5f, 2); TargetingLowHealthNode targetingLowestHPNode = new TargetingLowHealthNode(this, 2); TargetingHighestDamageNode targetingHighestDamageNode = new TargetingHighestDamageNode(this, 1); TargetingSightNode targetingSightNode = new TargetingSightNode(this, 1, true); CalculateTargetNode calculateTargetNode = new CalculateTargetNode(this); //Create arrow shot targeting sequence SequenceNode targetingSequence = new SequenceNode(this, "ArrowTargetingSequence", targetingDistanceNode, targetingLowestHPNode, targetingHighestDamageNode, targetingSightNode, calculateTargetNode); //Create other arrow shot nodes PlaySoundNode ArrowShotSoundNode = new PlaySoundNode(this, "ArrowFire"); CooldownNode arrowShotCooldownNode = new CooldownNode(this, ArrowShotRate); AnimatorNode arrowShotAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsFiringArrowShot", ref m_RegularShotLink); ShootProjectileNode arrowShotProjectileNode = new ShootProjectileNode(this, ArrowShotDamage, ArrowProjectilePrefab, ShootLocation, "InannaArrowPool", 5); //Create arrow shot sequence SequenceNode arrowShotSequence = new SequenceNode(this, "ArrowShotSequence", targetingSequence, arrowShotCooldownNode, arrowShotAnimationNode, ArrowShotSoundNode, arrowShotProjectileNode); //Create utility selector SelectorNode utilitySelector = new SelectorNode(this, "InannaUtilitySelector", repositionSequence, arrowRainSequence, snipeSequence, arrowShotSequence); 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); }