Пример #1
0
        protected virtual Node.Node CreateAttackingSequence()
        {
            Node.Node targetingSequence = CreateTargetingSequence();

            //create ability node
            CooldownNode cooldownNode       = new CooldownNode(this, ProjectileAttackRate);
            AnimatorNode shootAnimationNode = new AnimatorNode(this, m_AnimatorRef, "IsShooting", ref m_ShootLink);

            //TODO: UNCOMMENT THIS CODE AND ADD THE STRING NAME
            PlaySoundNode  shotNodeSFX            = new PlaySoundNode(this, "WorshipperShoot");
            SummonShotNode summonShotNode         = new SummonShotNode(this, ProjectileDamage, ProjectilePrefab, FireLocation, ProjectilePoolName, ProjectilePoolSize);
            CooldownNode   repositionCooldownNode = new CooldownNode(this, RepositionCooldown);

            //handle movement and movement
            BackAwayNode backAwayNode = new BackAwayNode(this, false, DirectionMultiplier);
            SideStepNode sideStep     = new SideStepNode(this, false, DirectionMultiplier);

            MovementOptionRandomNode randomMovementChoice = new MovementOptionRandomNode(this, backAwayNode, sideStep);

            SequenceNode attackingSequence = new SequenceNode(this, "Attacking Sequence", cooldownNode, shootAnimationNode, summonShotNode, shotNodeSFX, repositionCooldownNode, randomMovementChoice);

            //create the attacking options sequence for making the AI attack
            SequenceNode attackOptionSequence = new SequenceNode(this, "Attack Choice Sequence", targetingSequence, attackingSequence);

            return(attackOptionSequence);
        }
Пример #2
0
    public override void OnBodyGUI()
    {
        AnimatorNode target = ((AnimatorNode)this.target);

        //EditorGUILayout.LabelField("GameObject:", target.gameObject!=null?target.gameObject.name:"null");
        target.Animator = (UnityEngine.Animator)EditorGUILayout.ObjectField("Animator", target.Animator, typeof(UnityEngine.Animator), true);

        foreach (NodePort port in target.Outputs)
        {
            NodeEditorGUILayout.PortField(port);
        }

        /*
         * if (target.gameObject == null)
         * {
         *
         *  if (GUILayout.Button("Bind object"))
         *  {
         *      target.Bind(Selection.activeGameObject);
         *  };
         * }*/
        if (target.gameObject != null && target.initialized)
        {
            if (target.Animator != null)
            {
                target.Animator.runtimeAnimatorController = (UnityEngine.RuntimeAnimatorController)EditorGUILayout.ObjectField("Controller", target.Animator.runtimeAnimatorController, typeof(UnityEngine.RuntimeAnimatorController), true);

                for (int p = 0; p < target.Animator.parameters.Length; ++p)
                {
                    AnimatorControllerParameter parameter = target.Animator.parameters[p];
                    if (parameter.name != null && parameter.name.Length > 0)
                    {
                        if (parameter.type == AnimatorControllerParameterType.Bool || parameter.type == AnimatorControllerParameterType.Trigger)
                        {
                            target.Animator.SetBool(parameter.nameHash, EditorGUILayout.ToggleLeft(parameter.name, target.Animator.GetBool(parameter.nameHash)));
                        }
                        else if (parameter.type == AnimatorControllerParameterType.Int)
                        {
                            target.Animator.SetInteger(parameter.nameHash, EditorGUILayout.IntField(parameter.name, target.Animator.GetInteger(parameter.nameHash)));
                        }
                        else if (parameter.type == AnimatorControllerParameterType.Float)
                        {
                            target.Animator.SetFloat(parameter.nameHash, EditorGUILayout.FloatField(parameter.name, target.Animator.GetFloat(parameter.nameHash)));
                        }
                    }
                }
            }

            /*
             * if (GUILayout.Button("Rebind"))
             * {
             *  target.Bind(Selection.activeGameObject,true);
             * };*/
        }
        else
        {
            target.Bind(target.gameObject, true);
        }
    }
Пример #3
0
 public void SetInterval(AnimatedControl control, int milliseconds)
 {
     try
     {
         AnimatorNode node = m_Controls.Find(n => n.Control.Equals(control));
         node.Interval = milliseconds >= m_RefreshPeriod ? milliseconds / m_RefreshPeriod : 1;
     }
     catch (ArgumentNullException)
     {
         System.Diagnostics.Debug.WriteLine("Animator.SetInterval ArgumentNullException");
     }
 }
Пример #4
0
 public void Remove(AnimatedControl control)
 {
     try
     {
         AnimatorNode node = m_Controls.Find(n => n.Control.Equals(control));
         node.TickCount = 0;
         m_Controls.Remove(node);
     }
     catch (ArgumentNullException)
     {
         System.Diagnostics.Debug.WriteLine("Animator.Remove ArgumentNullException");
     }
 }
Пример #5
0
 public void Draw(AnimatedControl control)
 {
     try
     {
         AnimatorNode node = m_Controls.Find(n => n.Control.Equals(control));
         node.TickCount = 1;
         RunTimer(true);
     }
     catch (ArgumentNullException)
     {
         System.Diagnostics.Debug.WriteLine("Animator.Draw ArgumentNullException");
     }
 }
Пример #6
0
        public int GetInterval(AnimatedControl control)
        {
            int interval = -1;

            try
            {
                AnimatorNode node = m_Controls.Find(n => n.Control.Equals(control));
                interval = node.Interval * m_RefreshPeriod;
            }
            catch (ArgumentNullException)
            {
                System.Diagnostics.Debug.WriteLine("Animator.GetInterval ArgumentNullException");
            }
            return(interval);
        }
Пример #7
0
        protected override Node.Node CreateAttackingSequence()
        {
            Node.Node targetingSequence = CreateTargetingSequence();

            //Create the VampireSuckieSuckie attack sequence
            HealthLessThanNode healthCheckNode        = new HealthLessThanNode(this, PercentageOfHealthToAttack);
            UseOnceNode        usedShadowDrain        = new UseOnceNode(this);
            SequenceNode       healthandAttackNotUsed = new SequenceNode(this, "Health and Attack Check", healthCheckNode, usedShadowDrain);
            AnimatorNode       shadowDrainNode        = new AnimatorNode(this, m_AnimatorRef, "IsUsingDrainShot", ref m_DrainShotLink);
            ToggleAINode       toggleAINode           = new ToggleAINode(this);
            DrainningShotNode  fireProjectileNode     = new DrainningShotNode(this, ShadowDrainDamage, ShadowDrainProjectile, FireLocation, "AcolyteProjectile", 5);

            //TODO: UNCOMMENT AND ADD SOUND NAME
            //PlaySoundNode shadowDrainSFX = new PlaySoundNode(this, );

            SequenceNode shadowDrainSequence = new SequenceNode(this, "Shadow Drain Attack", healthandAttackNotUsed, shadowDrainNode, toggleAINode, /*shadowDrainSFX,*/ fireProjectileNode);

            //Create ability node
            CooldownNode   cooldownNode           = new CooldownNode(this, ProjectileAttackRate);
            AnimatorNode   shootAnimationNode     = new AnimatorNode(this, m_AnimatorRef, "IsShooting", ref m_ShootLink);
            SummonShotNode summonShotNode         = new SummonShotNode(this, ProjectileDamage, ProjectilePrefab, FireLocation, ProjectilePoolName, ProjectilePoolSize);
            CooldownNode   repositionCooldownNode = new CooldownNode(this, RepositionCooldown);
            //PlaySoundNode summonSFX = new PlaySoundNode(this,);

            //handle movement and movement
            BackAwayNode backAwayNode = new BackAwayNode(this, false, DirectionMultiplier * 2);
            SideStepNode sideStep     = new SideStepNode(this, false, DirectionMultiplier);

            MovementOptionRandomNode randomMovementChoice = new MovementOptionRandomNode(this, backAwayNode, sideStep);

            SequenceNode basicAttackingSequence = new SequenceNode(this, "Basic Attack Sequence", cooldownNode, shootAnimationNode, summonShotNode, /*summonSFX, */ repositionCooldownNode, randomMovementChoice);

            //create the attacking options sequence for making the AI attack
            SelectorNode attackSelector       = new SelectorNode(this, "Attack Selector", shadowDrainSequence, basicAttackingSequence);
            SequenceNode attackOptionSequence = new SequenceNode(this, "Attack Choice Sequence", targetingSequence, attackSelector);

            return(attackOptionSequence);
        }
Пример #8
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);
        }
Пример #9
0
        public override void OnInspectorGUI()
        {
            AnimatorNode go = ((AnimatorNode)target);

            EditorGUILayout.LabelField(go != null ? go.ToString() : "no obj");
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
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);
        }