Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        protected override SelectorNode CreateBehaviour()
        {
            //Create ability nodes
            DiveNode diveNode = new DiveNode(this, DiveCooldown, DiveDamage, DiveAngle);
            //TODO: COMMENT THIS SECTION AND ADD STRING
            //PlaySoundNode diveSFX = new PlaySoundNode(this, );
            CooldownNode spitCooldownNode = new CooldownNode(this, 1.0f);
            SequenceNode diveSequence     = new SequenceNode(this, "Dive Sequence", diveNode /*, diveSFX*/);
            //TODO: COMMENT THIS SECTION AND ADD STRING
            //PlaySoundNode spitSFX = new PlaySoundNode(this, );
            ShootProjectileNode shootProjectileNode = new ShootProjectileNode(this,
                                                                              ProjectileDamage,
                                                                              ProjectilePrefab,
                                                                              FireLocation,
                                                                              ProjectilePoolName,
                                                                              ProjectilePoolSize);

            SequenceNode spitSequence = new SequenceNode(this, "SpitSequence", spitCooldownNode, shootProjectileNode /*, spitSFX*/);

            //Create ability selector in order: Dive, Shoot Projectile
            SelectorNode abilitySelector = new SelectorNode(this, "AbilitySelector");

            abilitySelector.AddChildren(diveSequence, spitSequence);

            //Create targeting nodes
            TargetingMasterNergTarget targetingMasterNergTarget = new TargetingMasterNergTarget(this, 10);
            TargetingSightNode        targetingSightNode        = new TargetingSightNode(this, 1);
            CalculateTargetNode       calculateTargetNode       = new CalculateTargetNode(this);

            //Create targeting sequence
            SequenceNode targetingSequence = new SequenceNode(this, "TargetingSequence");

            targetingSequence.AddChildren(targetingMasterNergTarget, targetingSightNode, calculateTargetNode);

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

            getTargetAndUseAbilitySequence.AddChildren(targetingSequence, abilitySelector);

            //Create utility selector
            SelectorNode utilitySelector = new SelectorNode(this, "UtilitySelector");

            utilitySelector.AddChildren(getTargetAndUseAbilitySequence);

            return(utilitySelector);
        }
Ejemplo n.º 3
0
        protected override SelectorNode CreateBehaviour()
        {
            //craete the targeting sequence
            TargetingDistanceNode targetingDist   = new TargetingDistanceNode(this, 1);
            CalculateTargetNode   calculateTarget = new CalculateTargetNode(this);

            //assign targeting sequence
            SequenceNode targetingSequence = new SequenceNode(this, "Targeting Sequence", targetingDist, calculateTarget);

            ApproachNode approachPlayer = new ApproachNode(this);

            //create the attack player sequence
            SequenceNode attackPlayer = new SequenceNode(this, "Attack&TargetSequence", targetingSequence, approachPlayer);

            SelectorNode utlitySelector = new SelectorNode(this, "UtilitySelector", attackPlayer);

            return(utlitySelector);
        }
Ejemplo n.º 4
0
        protected virtual Node.Node CreateTargetingSequence()
        {
            //Create the targeting nodes
            TargetingSightNode         targetSightNode            = new TargetingSightNode(this, 1);
            TargetingDistanceNode      targetingDistanceNode      = new TargetingDistanceNode(this, 1);
            TargetingHighHealthNode    targetingHighHealthNode    = new TargetingHighHealthNode(this, 1);
            TargetingHighestDamageNode targetingHighestDamageNode = new TargetingHighestDamageNode(this, 2);
            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(targetingDistanceNode,
                                          targetingHighHealthNode,
                                          targetingHighestDamageNode,
                                          targetingCharacterType,
                                          calculateTargetNode);

            return(targetingSequence);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
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);
        }