Example #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            if (grappleHandler == null)
            {
                grappleHandler = base.GetComponent <TetherHandler>();
                if (grappleHandler == null)
                {
                    grappleHandler = base.gameObject.AddComponent <TetherHandler>();
                    Debug.LogWarning("Added grapple handler via fireball function");
                }
            }

            this.duration = this.baseDuration / this.attackSpeedStat;
            if (this.grappleHandler && this.grappleHandler.hasGrappleTarget())
            {
                //this.damageStat = this.grappleHandler.GetGrappleTarget().healthComponent.body.damage;
                //this.duration = this.baseDuration / this.grappleHandler.GetGrappleTarget().healthComponent.body.attackSpeed;
            }

            this.fireDuration = 0.25f * this.duration;
            base.characterBody.SetAimTimer(2f);
            this.animator     = base.GetModelAnimator();
            this.muzzleString = "Muzzle";


            base.PlayAnimation("Gesture, Override", "FireArrow", "FireArrow.playbackRate", this.duration);
        }
Example #2
0
        void Start()
        {
            Debug.LogWarning("Tether handler start function run on " + gameObject);
            instance        = this;
            motor           = transform.root.GetComponentInChildren <CharacterMotor>();
            direction       = transform.root.GetComponentInChildren <CharacterDirection>();
            healthComponent = transform.root.GetComponentInChildren <HealthComponent>();

            GrappleTargets = new List <GrappleTarget>();
        }
Example #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            if (grappleHandler == null)
            {
                grappleHandler = base.GetComponent <TetherHandler>();
                if (grappleHandler == null)
                {
                    grappleHandler = base.gameObject.AddComponent <TetherHandler>();
                    Debug.LogWarning("Added grapple handler via burst function");
                }
            }

            this.duration     = this.baseDuration / this.attackSpeedStat;
            this.fireDuration = 0.25f * this.duration;
            base.characterBody.SetAimTimer(2f);
            this.muzzleString = "Muzzle";

            base.PlayAnimation("Gesture, Override", "FireArrow", "FireArrow.playbackRate", this.duration);
        }
Example #4
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration     = this.baseDuration / this.attackSpeedStat;
            this.fireDuration = 0f;
            base.characterBody.SetAimTimer(2f);
            this.animator     = base.GetModelAnimator();
            this.muzzleString = "Muzzle";

            if (grappleHandler == null)
            {
                grappleHandler = base.GetComponent <TetherHandler>();
                if (grappleHandler == null)
                {
                    grappleHandler = base.gameObject.AddComponent <TetherHandler>();
                    Debug.LogWarning("Added grapple handler via invigorate skill");
                }
            }

            base.PlayAnimation("Gesture, Override", "FireGrenade", "FireGrenade.playbackRate", this.duration);
        }
Example #5
0
        private void DoTether()
        {
            if (this.hasFired)
            {
                return;
            }
            this.hasFired = true;
            Debug.Log("Setting tether handler!");

            //base.isAuthority -> will only run on local machine
            //if (base.isAuthority)
            //{
            tetherHandler = base.GetComponent <TetherHandler>();

            HurtBox closestHurtbox = null;

            Debug.Log("Raycasting!");
            //First check to see if we're aiming at a valid target
            Ray        aimRay      = base.GetAimRay();
            RaycastHit raycastHit  = new RaycastHit();
            bool       foundTarget = Physics.Raycast(aimRay, out raycastHit, maxDistanceFilter);

            if (foundTarget && raycastHit.collider.GetComponent <HurtBox>())
            {
                TeamIndex targetTeamIndex = raycastHit.collider.GetComponent <HurtBox>().healthComponent.body.teamComponent.teamIndex;
                //Make sure we're not targeting the enemy team
                if (base.GetTeam() == targetTeamIndex)
                {
                    closestHurtbox = raycastHit.collider.GetComponent <HurtBox>();
                    Debug.Log("Found aimed at object " + closestHurtbox.transform.root.name);
                }
            }
            //If we weren't aiming at something, just search for a valid nearby target
            else
            {
                //Search for all nearby targets
                BullseyeSearch bullseyeSearch = new BullseyeSearch();
                bullseyeSearch.searchOrigin      = base.transform.position;
                bullseyeSearch.searchDirection   = UnityEngine.Random.onUnitSphere;
                bullseyeSearch.maxDistanceFilter = maxDistanceFilter;
                TeamMask sameTeamMask = new TeamMask();
                sameTeamMask.AddTeam(base.GetTeam());
                bullseyeSearch.teamMaskFilter = sameTeamMask;

                //Sort by distance
                bullseyeSearch.sortMode = BullseyeSearch.SortMode.Distance;
                bullseyeSearch.RefreshCandidates();
                //Remove ourselves from the search results
                //(shouldn't be there in the first place, but hey)
                bullseyeSearch.FilterOutGameObject(base.gameObject);

                //Get the closest hurtbox
                closestHurtbox = bullseyeSearch.GetResults().FirstOrDefault <HurtBox>();

                Debug.Log("Found local object " + closestHurtbox.transform.root.name);
                if (closestHurtbox == default(HurtBox))
                {
                    Debug.LogError("Default value!");
                }
                if (closestHurtbox == null)
                {
                    Debug.LogError("Null value!");
                }
            }

            //Set up our grapple handler
            if (tetherHandler == null)
            {
                tetherHandler = base.gameObject.AddComponent <TetherHandler>();
                Debug.LogWarning("Added grapple handler via tether function");
                return;
            }

            //Then establish our grapple target
            if (closestHurtbox == null)
            {
                Debug.LogError("Null hurtbox");
                return;
            }
            //If we've successfully established a tether
            else if (closestHurtbox)
            {
                Debug.Log("Attempting to establish tether");
                //If adding a new grapple target would go beyond our max stock
                int curNumGrappled = tetherHandler.GetGrappleTargets().Count;
                if (curNumGrappled + 1 > base.activatorSkillSlot.maxStock)
                {
                    //Remove the oldest grapple target
                    tetherHandler.ClearGrappleTarget(tetherHandler.GetGrappleTargets()[0]);
                }

                tetherHandler.SetGrappleTarget(closestHurtbox);
                tetherHandler.TETHER_TYPE = TETHER_TYPE.TETHER;
                Debug.Log("Set grapple target");

                base.characterBody.AddBuff(WispSurvivor.Modules.Buffs.sustainSelf);
                closestHurtbox.healthComponent.body.AddBuff(WispSurvivor.Modules.Buffs.sustainTarget);
            }
            //}

            /*
             *  this.animator = base.GetModelAnimator();
             *  this.muzzleString = "Muzzle";
             *
             *
             *  base.PlayAnimation("Gesture, Override", "FireGrapple", "FireGrapple.playbackRate", this.duration);
             */
        }