Inheritance: MonoBehaviour
 void Awake()
 {
     Transform launchPointTrans = transform.Find ("LaunchPoint");
     launchPoint = launchPointTrans.gameObject;
     launchPoint.SetActive (false);
     launchPos = launchPointTrans.position;
     S = this;
 }
        private static void Prefix(Slingshot __instance)
        {
            if (BetterSlingshotsMod.Instance.IsAutoFire)
            {
                BetterSlingshotsMod.Instance.Helper.Reflection.GetField <bool>(__instance, "canPlaySound").SetValue(false);
            }

            SlingshotDoFunctionPatch.lastFiredAmmo = __instance.attachments[0];
        }
 void Awake()
 {
     // Set the Slingshot singleton S
     S = this;
     Transform launchPointTrans = transform.Find("LaunchPoint");
     launchPoint = launchPointTrans.gameObject;
     launchPoint.SetActive( false );
     launchPos = launchPointTrans.position;
 }
    void Awake()
    {
        S = this;
        Transform launchpointTrans = transform.Find("LaunchPoint");             // Searches for the LaunchPoint game Object.

        launchPoint = launchpointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchpointTrans.position;
    }
        private static bool Prefix(Slingshot __instance)
        {
            if (__instance != SlingshotFinishPatch.instanceToControl || SlingshotFinishPatch.instanceToControl == null)
            {
                return(true);
            }

            return(SlingshotFinishPatch.shouldRun);
        }
 void Awake()
 {
     //set the slingshit singlteton to s
     S=this;
     Transform launchPointTrans = transform.Find ("LaunchPoint");
     launchPoint = launchPointTrans.gameObject;
     launchPoint.SetActive (false);
     launchPos = launchPointTrans.position;
 }
 void Awake()
 {
     // SET THE SLINGSHOT SINGLETON S
     S = this;
     Transform launchPointTrans = transform.Find("LaunchPoint");
     launchPoint = launchPointTrans.gameObject;
     launchPoint.SetActive(false);
     launchPos = launchPointTrans.position;
 }
Exemple #8
0
    private void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
    void Awake()
    {
        S = this; //Set the Slingshot singleton S. from pg 566 due to ProjectileLine script.
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        //Pg 544
        launchPos = launchPointTrans.position;
    }
Exemple #10
0
    void Awake()
    {
        S          = this;
        aimingMode = false;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;                              // c
    }
Exemple #11
0
    void Awake()
    {
        //set the slingshit singlteton to s
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
    /*void OnCollisionEnter(Collision other)
     * {
     *  if (other.gameObject.tag == "Castle")
     *  {
     *      Debug.Log("Collision detected");
     *      Hit();
     *
     *  }
     * }
     *
     * void Hit()
     * {
     *  GameManager.Instance.AddScore(scoreValue);
     * }*/

    private void Awake()
    {
        S = this; // Set the slingshot singleton S

        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
Exemple #13
0
        void Awake()
    {
        S = this;
                Transform launchPointTrans = transform.Find("LaunchPoint");

                launchPoint = launchPointTrans.gameObject;
                launchPoint.SetActive(false);
                launchPos = launchPointTrans.position;                               // c
                
    }
Exemple #14
0
    void Awake()
    {
        //Set the Slingshot singleton so that it can be accessed in ProjectileLine
        S = this;

        Transform launchPointTrans = transform.Find("LaunchPoint");
        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive( false );
        launchPos = launchPointTrans.position;
    }
    void Awake()
    {
        // Set the Slingshot singleton S
        S = this;
        Transform launchPointTrans = transform.FindChild("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;;
    }
    void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
        //  Debug.Log("In awake");
    }
    void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");
        lanuchPoint = launchPointTrans.gameObject;
        lanuchPoint.SetActive( false );
        launchPos = launchPointTrans.position;

        mAudioSrc = GetComponent<AudioSource>();
    }
    void Awake()
    {
        // SET THE SLINGSHOT SINGLETON S
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
    void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.FindChild("LaunchPoint");

        //searches for slingshot named launchpoint and returns its transform (position, rotation, scale)
        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
Exemple #20
0
        public PlayerState(int m, int d, int l, IEnumerable <Item> i)
        {
            this.money              = m;
            this.deepestMineLevel   = d;
            this.lowestLevelReached = l;
            this.inventory          = new List <Item>();
            foreach (Item item in i)
            {
                if (item == null)
                {
                    this.inventory.Add(null);
                }
                else
                {
                    Item copy;
                    if (item is Slingshot slingshot)
                    {
                        Slingshot slingshotCopy = slingshot.getOne() as Slingshot;
                        slingshotCopy.InitialParentTileIndex = slingshot.InitialParentTileIndex;
                        slingshotCopy.CurrentParentTileIndex = slingshot.InitialParentTileIndex;
                        slingshotCopy.IndexOfMenuItemView    = slingshot.IndexOfMenuItemView;

                        if (slingshot.attachments[0] != null)
                        {
                            slingshotCopy.attachments[0]       = slingshot.attachments[0].getOne() as StardewValley.Object;
                            slingshotCopy.attachments[0].Stack = slingshot.attachments[0].Stack;
                        }
                        copy = slingshotCopy;
                    }
                    else if (item is FishingRod rod)
                    {
                        FishingRod rodCopy = rod.getOne() as FishingRod;

                        for (int index = 0; index < rodCopy.numAttachmentSlots.Value; index++)
                        {
                            if (rod.attachments[index] != null)
                            {
                                rodCopy.attachments[index]       = rod.attachments[index].getOne() as StardewValley.Object;
                                rodCopy.attachments[index].Stack = rod.attachments[index].Stack;
                            }
                        }

                        copy = rodCopy;
                    }
                    else
                    {
                        copy = item.getOne();
                    }

                    copy.Stack = item.Stack;

                    this.inventory.Add(copy);
                }
            }
        }
    // ------------------------------------

    private void Awake()
    {
        // --- Added for linerenderer p.533 ---
        S = this;
        // ------------------------------------
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
Exemple #22
0
    void Awake()
    {
        //Set the Slingshot singleton S
        S = this;

        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = new Vector3(launchPointTrans.position.x, launchPointTrans.position.y, launchPointTrans.position.z);
    }
 private bool HasAmmunition(Slingshot slingshot)
 {
     foreach (Object attachment in slingshot.attachments.Fields)
     {
         if (attachment != null && attachment.Stack > 0)
         {
             return(true);
         }
     }
     return(false);
 }
    void Awake()
    {
        S = this;
        //search for a child of slingshot (launchpoint) and returns it`s transform
        Transform launchPointTrans = transform.Find("LaunchPoint");

        //associates that transform with gameObject and assigns it to the gameObject field launchpoint
        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
    private void Awake()
    {
        // Save instance of singleton
        S = this;

        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
Exemple #26
0
    void Awake()
    {
        //Set the Slingshot singleton so that it can be accessed in ProjectileLine
        S = this;

        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
Exemple #27
0
    // use "LateUpdate to ensure that we get the value for velocityVect.
    void LateUpdate()
    {
        Debug.Log("Drawing Ballistic Arc");
        // we know this is highly inefficient but wanted to get it working asap
        Slingshot ss = gameObject.transform.parent.GetComponent <Slingshot>() as Slingshot;
        PullZone  pz = ss.GetComponentInChildren <PullZone>();

        if ((ss.slingshotHand == "left" && pz.loadedObject != null) ||
            (ss.slingshotHand == "right" && pz.loadedObject != null))
        {
            Vector3 velocityVect = ss.CalculateV();
            lr.positionCount = (int)(timeMaximum / timeStep);

            Vector3 currPos = transform.position;

            int i = 0;             // index


            for (float t = 0.0f; t < timeMaximum; t += timeStep)
            {
                lr.SetPosition(i, currPos);


                // project target impact point
                RaycastHit impact;

                if (Physics.Raycast(currPos, velocityVect, out impact, velocityVect.magnitude, layerMask))
                {
                    lr.positionCount = i + 2;
                    lr.SetPosition(i + 1, impact.point);

                    if (impactCircle != null)
                    {
                        if (impactCircleInstance != null)
                        {
                            impactCircleInstance.transform.position = impact.point;
                        }
                        else
                        {
                            impactCircleInstance = Instantiate(impactCircle, impact.point, Quaternion.identity) as GameObject;
                            impactCircleInstance.transform.parent = gameObject.transform;
                        }
                    }
                    break;
                }
                // update position
                currPos = currPos + (velocityVect * timeStep);

                // account for gravity on arc
                velocityVect += (Physics.gravity * timeStep);
                i++;
            }
        }
    }
    private void Awake()
    {
        S = this;

        //find a Launch Point object and get its Transform coordinates
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
Exemple #29
0
    void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos          = launchPointTrans.position;
        rubberBand         = GetComponent <LineRenderer>();
        rubberBand.enabled = true;
    }
Exemple #30
0
     /*************************************************************************************************
     *** Start
     *************************************************************************************************/
     void Awake()
     {
          //Set the Slingshot singleton S
          S = this;

          pauseMenu = FindObjectOfType<Pause_Menu>();

          launchPoint.SetActive(false);
          launchPos = launchPoint.transform.position;

     }//void Start
    void Awake()
    {
        S = this;

        launchPointTrans = transform.Find("LaunchPoint");
        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;

        sCollider = GetComponent<SphereCollider>();
    }
Exemple #32
0
    void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;

        projectileRigidbody             = projectile.GetComponent <Rigidbody>();
        projectileRigidbody.isKinematic = true;
    }
Exemple #33
0
    //Finds the point of launch and sets the halo to be invisible at start.
    private void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;

        slingLine         = GetComponent <LineRenderer>();
        slingLine.enabled = false;
    }
    void Awake()
    {
        S = this;
        //transform.Find searches for a child of Slingshot named LP and returns
        //its transform.
        Transform launchPointTrans = transform.Find("LaunchPoint");

        //gets gameobj associated with Transform and assigns to game obj field 'launchPoint'
        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
Exemple #35
0
    // Awake is called when the script instance is being loaded.
    void Awake()
    {
        PrintDebugMsg("Loaded.");

        S = this;

        Transform launchPointTrans = transform.Find("LaunchPoint");

        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;
    }
        private static void FixLastFiredProjectileVelocity(Slingshot slingshot)
        {
            if (Game1.currentLocation.projectiles.Count == 0)
            {
                return;
            }

            Projectile firedProjectile = Game1.currentLocation.projectiles[Game1.currentLocation.projectiles.Count - 1];
            Vector2    newVelocity     = Utils.GetCorrectVelocity(new Vector2(slingshot.aimPos.X, slingshot.aimPos.Y), slingshot.getLastFarmerToUse(), !BetterSlingshotsMod.Instance.Config.DisableReverseAiming);

            BetterSlingshotsMod.Instance.Helper.Reflection.GetField <NetFloat>(firedProjectile, "xVelocity").GetValue().Value = newVelocity.X;
            BetterSlingshotsMod.Instance.Helper.Reflection.GetField <NetFloat>(firedProjectile, "yVelocity").GetValue().Value = newVelocity.Y;
        }
    void Awake()
    {
        // Set the Slingshot singleton S
        S = this;

        Transform launchPointTrans = transform.Find("LaunchPoint");
        launchPoint = launchPointTrans.gameObject;


        // .SetActive just deactivates the GameObject in our scene, doesn't remove it. Can be re-activated. We deactivate the game object so it activates only when mouse passes over it.
        launchPoint.SetActive(false);
        launchPos = launchPointTrans.position;

    }
    void Awake()
    {
        S = this;
        Transform launchPointTrans = transform.Find ("LaunchPoint");
        launchPoint = launchPointTrans.gameObject;
        launchPoint.SetActive (false);
        launchPos = launchPointTrans.position;

        for (int i = 0; i < prefabProjectileList.Count; i ++) {

            projectileList.Add (prefabProjectileList [i]);

        }

        prefabProjectile = projectileList [0];
    }
 // Use this for initialization
 void Start()
 {
     S = this;
     ammoText.text="Ammo: "+numShots;
 }
 private void getSlingshot()
 {
     slingshot = GetComponentInChildren<Slingshot>();
 }