コード例 #1
0
 private void Awake()
 {
     this.parent = base.GetComponentInParent <rockSound>();
     if (this.parent == null)
     {
         base.enabled = false;
     }
 }
コード例 #2
0
 public override void fireProjectile()
 {
     if (LocalPlayer.Inventory.RemoveItem(_ammoItemId, 1, false, true))
     {
         Vector3    position = _ammoSpawnPos.transform.position;
         Quaternion rotation = _ammoSpawnPos.transform.rotation;
         if (ForestVR.Enabled)
         {
             position = _ammoSpawnPosVR.transform.position;
             rotation = _ammoSpawnPosVR.transform.rotation;
         }
         GameObject gameObject = Object.Instantiate(_Ammo, position, rotation);
         gameObject.transform.localScale *= ModdedPlayer.instance.ProjectileSizeRatio;
         Rigidbody component  = gameObject.GetComponent <Rigidbody>();
         rockSound component2 = gameObject.GetComponent <rockSound>();
         if ((bool)component2)
         {
             component2.slingShot = true;
         }
         if (BoltNetwork.isRunning)
         {
             BoltEntity component3 = gameObject.GetComponent <BoltEntity>();
             if ((bool)component3)
             {
                 BoltNetwork.Attach(gameObject);
             }
         }
         PickUp componentInChildren = gameObject.GetComponentInChildren <PickUp>();
         if ((bool)componentInChildren)
         {
             SheenBillboard[] componentsInChildren = gameObject.GetComponentsInChildren <SheenBillboard>();
             SheenBillboard[] array = componentsInChildren;
             foreach (SheenBillboard sheenBillboard in array)
             {
                 sheenBillboard.gameObject.SetActive(false);
             }
             componentInChildren.gameObject.SetActive(false);
             if (base.gameObject.activeInHierarchy)
             {
                 base.StartCoroutine(enablePickupTrigger(componentInChildren.gameObject));
             }
         }
         Vector3 forward = _ammoSpawnPos.transform.forward;
         if (ForestVR.Enabled)
         {
             forward = _ammoSpawnPosVR.transform.forward;
         }
         component.AddForce(4000f * ModdedPlayer.instance.ProjectileSpeedRatio * (0.016666f / Time.fixedDeltaTime) * forward);
     }
 }
コード例 #3
0
 public void fireProjectile()
 {
     if (LocalPlayer.Inventory.RemoveItem(this._ammoItemId, 1, false, true))
     {
         Vector3    position = this._ammoSpawnPos.transform.position;
         Quaternion rotation = this._ammoSpawnPos.transform.rotation;
         if (ForestVR.Enabled)
         {
             position = this._ammoSpawnPosVR.transform.position;
             rotation = this._ammoSpawnPosVR.transform.rotation;
         }
         GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this._Ammo, position, rotation);
         Rigidbody  component  = gameObject.GetComponent <Rigidbody>();
         rockSound  component2 = gameObject.GetComponent <rockSound>();
         if (component2)
         {
             component2.slingShot = true;
         }
         if (BoltNetwork.isRunning)
         {
             BoltEntity component3 = gameObject.GetComponent <BoltEntity>();
             if (component3)
             {
                 BoltNetwork.Attach(gameObject);
             }
         }
         PickUp componentInChildren = gameObject.GetComponentInChildren <PickUp>();
         if (componentInChildren)
         {
             SheenBillboard[] componentsInChildren = gameObject.GetComponentsInChildren <SheenBillboard>();
             foreach (SheenBillboard sheenBillboard in componentsInChildren)
             {
                 sheenBillboard.gameObject.SetActive(false);
             }
             componentInChildren.gameObject.SetActive(false);
             if (base.gameObject.activeInHierarchy)
             {
                 base.StartCoroutine(this.enablePickupTrigger(componentInChildren.gameObject));
             }
         }
         Vector3 forward = this._ammoSpawnPos.transform.forward;
         if (ForestVR.Enabled)
         {
             forward = this._ammoSpawnPosVR.transform.forward;
         }
         component.AddForce(4000f * (0.016666f / Time.fixedDeltaTime) * forward);
     }
 }
コード例 #4
0
        public override void fireProjectile()
        {
            int repeats = ModdedPlayer.RangedRepetitions();

            ChampionsOfForest.COTFEvents.Instance.OnAttackRanged.Invoke();

            for (int i = 0; i < repeats; i++)
            {
                bool noconsume = ModdedPlayer.Stats.perk_projectileNoConsumeChance >= 0 && Random.value < ModdedPlayer.Stats.perk_projectileNoConsumeChance;
                if (noconsume || LocalPlayer.Inventory.RemoveItem(_ammoItemId, 1, false, true))
                {
                    Vector3 position = _ammoSpawnPos.transform.position;
                    if (i > 0)
                    {
                        position += 0.5f * _ammoSpawnPos.transform.up * (i + 1) / 3;
                        position += 0.5f * _ammoSpawnPos.transform.right * (((i - 1) % 3) - 1);
                    }
                    Quaternion rotation = _ammoSpawnPos.transform.rotation;
                    if (ForestVR.Enabled)
                    {
                        position = _ammoSpawnPosVR.transform.position;
                        rotation = _ammoSpawnPosVR.transform.rotation;
                    }
                    GameObject gameObject = Object.Instantiate(_Ammo, position, rotation);
                    gameObject.transform.localScale *= ModdedPlayer.Stats.projectileSize;

                    Rigidbody component  = gameObject.GetComponent <Rigidbody>();
                    rockSound component2 = gameObject.GetComponent <rockSound>();
                    if ((bool)component2)
                    {
                        component2.slingShot = true;
                    }
                    if (BoltNetwork.isRunning)
                    {
                        BoltEntity component3 = gameObject.GetComponent <BoltEntity>();
                        if ((bool)component3)
                        {
                            BoltNetwork.Attach(gameObject);
                        }
                    }
                    PickUp componentInChildren = gameObject.GetComponentInChildren <PickUp>();
                    if ((bool)componentInChildren)
                    {
                        SheenBillboard[] componentsInChildren = gameObject.GetComponentsInChildren <SheenBillboard>();
                        SheenBillboard[] array = componentsInChildren;
                        foreach (SheenBillboard sheenBillboard in array)
                        {
                            sheenBillboard.gameObject.SetActive(false);
                        }
                        componentInChildren.gameObject.SetActive(false);
                        if (base.gameObject.activeInHierarchy)
                        {
                            base.StartCoroutine(enablePickupTrigger(componentInChildren.gameObject));
                        }
                    }
                    Vector3 forward = _ammoSpawnPos.transform.forward;
                    if (ForestVR.Enabled)
                    {
                        forward = _ammoSpawnPosVR.transform.forward;
                    }
                    component.AddForce(4000f * ModdedPlayer.Stats.projectileSpeed * (0.016666f / Time.fixedDeltaTime) * forward);
                }
            }
        }
コード例 #5
0
        public override void fireProjectile()
        {
            int repeats = 1;

            if (Effects.Multishot.IsOn)
            {
                if (SpellCaster.RemoveStamina(5 * ModdedPlayer.instance.MultishotCount * ModdedPlayer.instance.MultishotCount))
                {
                    repeats += ModdedPlayer.instance.MultishotCount;
                }
                else
                {
                    Effects.Multishot.IsOn = false;
                    Effects.Multishot.localPlayerInstance.SetActive(false);
                }
            }
            for (int i = 0; i < repeats; i++)
            {
                if (LocalPlayer.Inventory.RemoveItem(_ammoItemId, 1, false, true))
                {
                    Vector3 position = _ammoSpawnPos.transform.position;
                    if (i > 0)
                    {
                        position += 0.5f * _ammoSpawnPos.transform.up * (i + 1) / 3;
                        position += 0.5f * _ammoSpawnPos.transform.right * (((i - 1) % 3) - 1);
                    }
                    Quaternion rotation = _ammoSpawnPos.transform.rotation;
                    if (ForestVR.Enabled)
                    {
                        position = _ammoSpawnPosVR.transform.position;
                        rotation = _ammoSpawnPosVR.transform.rotation;
                    }
                    GameObject gameObject = Object.Instantiate(_Ammo, position, rotation);
                    gameObject.transform.localScale *= ModdedPlayer.instance.ProjectileSizeRatio;
                    gameObject.tag = "projectile";
                    gameObject.AddComponent <ProjectileIgnoreCollision>();
                    Rigidbody component  = gameObject.GetComponent <Rigidbody>();
                    rockSound component2 = gameObject.GetComponent <rockSound>();
                    if ((bool)component2)
                    {
                        component2.slingShot = true;
                    }
                    if (BoltNetwork.isRunning)
                    {
                        BoltEntity component3 = gameObject.GetComponent <BoltEntity>();
                        if ((bool)component3)
                        {
                            BoltNetwork.Attach(gameObject);
                        }
                    }
                    PickUp componentInChildren = gameObject.GetComponentInChildren <PickUp>();
                    if ((bool)componentInChildren)
                    {
                        SheenBillboard[] componentsInChildren = gameObject.GetComponentsInChildren <SheenBillboard>();
                        SheenBillboard[] array = componentsInChildren;
                        foreach (SheenBillboard sheenBillboard in array)
                        {
                            sheenBillboard.gameObject.SetActive(false);
                        }
                        componentInChildren.gameObject.SetActive(false);
                        if (base.gameObject.activeInHierarchy)
                        {
                            base.StartCoroutine(enablePickupTrigger(componentInChildren.gameObject));
                        }
                    }
                    Vector3 forward = _ammoSpawnPos.transform.forward;
                    if (ForestVR.Enabled)
                    {
                        forward = _ammoSpawnPosVR.transform.forward;
                    }
                    component.AddForce(4000f * ModdedPlayer.instance.ProjectileSpeedRatio * (0.016666f / Time.fixedDeltaTime) * forward);
                }
            }
        }