コード例 #1
0
 private void Throw()
 {
     if (this.grabController)
     {
         this.grabController.Throw(base.GetAimRay().direction *GrabSuccess.throwForce);
         this.grabController = null;
         this.target         = null;
     }
 }
コード例 #2
0
ファイル: GrabAttempt.cs プロジェクト: ArcPh1r3/RegigigasMod
        private void AttemptGrab(float grabRadius)
        {
            if (this.grabController)
            {
                return;
            }

            Ray aimRay = base.GetAimRay();

            BullseyeSearch search = new BullseyeSearch
            {
                teamMaskFilter    = TeamMask.GetEnemyTeams(base.GetTeam()),
                filterByLoS       = false,
                searchOrigin      = this.grabTransform.position,
                searchDirection   = Random.onUnitSphere,
                sortMode          = BullseyeSearch.SortMode.Distance,
                maxDistanceFilter = grabRadius,
                maxAngleFilter    = 360f
            };

            search.RefreshCandidates();
            search.FilterOutGameObject(base.gameObject);

            HurtBox target = search.GetResults().FirstOrDefault <HurtBox>();

            if (target)
            {
                if (target.healthComponent && target.healthComponent.body)
                {
                    if (BodyMeetsGrabConditions(target.healthComponent.body))
                    {
                        this.grabController = target.healthComponent.body.gameObject.AddComponent <RegigigasGrabController>();
                        this.grabController.pivotTransform         = this.grabTransform;
                        this.grabController.grabberHealthComponent = base.healthComponent;
                        this.grabTarget = target;
                        return;
                    }
                }
            }
        }