Example #1
0
        //Event called when bullet hits anything
        private bool CallBack(BulletAttack bulletattack, ref BulletAttack.BulletHit hitInfo)
        {
            //Run the hit as normal first
            bool hit = BulletAttack.DefaultHitCallbackImplementation(bulletattack, ref hitInfo);
            //Pos is where the bullet hit
            Vector3 pos = hitInfo.point;

            //If it actually hit something, add the main hurtbox of them to our list
            if (hitInfo.hitHurtBox)
            {
                hitHurtBoxes.Add(hitInfo.hitHurtBox.hurtBoxGroup.mainHurtBox);
            }
            //Execute our richochet code
            HandleRichochet(pos);
            //Return the previously found hit / nohit
            return(hit);
        }
Example #2
0
            public static bool AltModeHitCallback(BulletAttack atk, ref BulletAttack.BulletHit hitInfo)
            {
                var retv = BulletAttack.DefaultHitCallbackImplementation(atk, ref hitInfo);

                if (!atk.owner)
                {
                    return(false);
                }
                if (!atk.owner.TryGetComponent <CommandoPrimaryPulseAltModeTracker>(out var tracker))
                {
                    tracker = atk.owner.AddComponent <CommandoPrimaryPulseAltModeTracker>();
                }
                if (hitInfo.hitHurtBox && hitInfo.hitHurtBox.healthComponent)
                {
                    tracker.OnHit(hitInfo.hitHurtBox.healthComponent.gameObject);
                }
                else
                {
                    tracker.OnHit(null);
                }
                return(retv);
            }