Exemple #1
0
        private void SetBeamTarget()
        {
            if (Targeting.GetTarget(This_Cyclops_Root, maxLaserDistance, out targetGameobject, out targetDist))
            {
                lock (targetGameobject)
                {
                    if (isOnlyHostile)
                    {
                        Targeting.GetRoot(targetGameobject, out TechType targetTechType, out GameObject examinedGameObject);

                        if (!validTargets.Contains(targetTechType))
                        {
                            CalculateBeamVectors(targetDist);
                            return;
                        }
                    }

                    CalculateBeamVectors(targetDist);

                    AddDamageToTarget(targetGameobject);

                    AddForceToTarget(Player.main.camRoot.GetAimingTransform(), targetGameobject);
                }
            }
            else
            {
                CalculateBeamVectors(maxLaserDistance);
            }
        }
        private void SetBeamTarget()
        {
            if (Targeting.GetTarget(thisSeamoth.gameObject, maxLaserDistance, out targetGameobject, out targetDist))
            {
                lock (targetGameobject)
                {
                    if (isOnlyHostile)
                    {
                        Targeting.GetRoot(targetGameobject, out TechType targetTechType, out GameObject examinedGameObject);

                        if (!validTargets.Contains(targetTechType))
                        {
                            CalculateBeamVectors(targetDist);
                            return;
                        }
                    }

                    CalculateBeamVectors(targetDist);

                    AddDamageToTarget(targetGameobject);

                    AddForceToTarget();
                }
            }
            else
            {
                CalculateBeamVectors(maxLaserDistance);
            }
        }
        public static void Postfix()
        {
            if (uGUI_BuilderMenu.IsOpen() || !Input.GetMouseButton(2) || Builder.isPlacing)
            {
                return;
            }
            if (!Targeting.GetTarget(Player.main.gameObject, 200f, out var result, out _))
            {
                return;
            }
            if (!Targeting.GetRoot(result, out var techType, out var gameObject)
#if SN1
                || !CraftData.IsBuildableTech(techType)
#elif BZ
                || !TechData.GetBuildable(techType)
#endif
                )
            {
                return;
            }
#if SN1
            if (Builder.Begin(gameObject))
            {
                ErrorMessage.AddMessage($"Placing new {techType}");
            }
            else
            {
                Builder.End();
            }
#elif BZ
            CoroutineHost.StartCoroutine(Builder.BeginAsync(techType));
            ErrorMessage.AddMessage($"Placing new {techType}");
#endif
        }
 public static void Postfix()
 {
     if (!uGUI_BuilderMenu.IsOpen() && Input.GetMouseButton(2) && !Builder.isPlacing)
     {
         if (Targeting.GetTarget(Player.main.gameObject, 200f, out GameObject result, out _))
         {
             if (Targeting.GetRoot(result, out TechType techType, out GameObject gameObject) && CraftData.IsBuildableTech(techType))
             {
                 if (Builder.Begin(gameObject))
                 {
                     ErrorMessage.AddMessage($"Placing new {techType}");
                 }
                 else
                 {
                     Builder.End();
                 }
             }
         }
     }
 }
        private Vector3 CalculateLaserBeam()
        {
            Targeting.GetTarget(seamoth.gameObject, maxLaserDistance, out targetGameobject, out targetDist);

            if (targetDist == 0f)
            {
                return(MainCamera.camera.transform.position + maxLaserDistance * MainCamera.camera.transform.forward);
            }
            else
            {
                if (onlyHostile)
                {
                    Targeting.GetRoot(targetGameobject, out TechType targetTechType, out GameObject examinedGameObject);

                    if (!validTargets.Contains(targetTechType))
                    {
                        return(MainCamera.camera.transform.position + targetDist * MainCamera.camera.transform.forward);
                    }
                }

                AddDamage(targetGameobject);
                return(MainCamera.camera.transform.position + targetDist * MainCamera.camera.transform.forward);
            }
        }