コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="response"></param>
        protected override void OnPickup(PickupResponse response)
        {
            base.OnPickup(response);

            if (response.autoPickup)
            {
                if (response.character.gameplayState == CharacterGameplayState.LaunchKey)
                {
                    return;
                }

                for (var i = 0; i < response.character.weapons.Length; ++i)
                {
                    if (response.character.weapons[i] == null)
                    {
                        response.Accept();
                        response.character.SetWeapon(i, _weaponDescriptor);
                        SpawnPickupText(_weaponDescriptor.name);
                        Telemetry.game.Incr($"{_weaponDescriptor.name}_pickup");
                        return;
                    }
                }
            }
            else
            {
                if (response.character.currentEquippable is WeaponEquippable)
                {
                    response.Accept();
                    Telemetry.game.Incr($"{_weaponDescriptor.name}_pickup");
                    for (var i = 0; i < response.character.weapons.Length; ++i)
                    {
                        if (response.character.weapons[i] == null)
                        {
                            response.character.SetWeapon(i, _weaponDescriptor);
                            SpawnPickupText(_weaponDescriptor.name);
                            Telemetry.game.Incr($"{_weaponDescriptor.name}_replace");
                            return;
                        }
                    }
                    response.character.SetWeapon(response.character.currentWeaponIndex, _weaponDescriptor);
                    SpawnPickupText(_weaponDescriptor.name);
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="response"></param>
        protected override void OnPickup(PickupResponse response)
        {
            base.OnPickup(response);

            Debug.Assert(_launchKeyEquippablePrefab != null);
            var character = response.character;

            character.SetEquippable(Instantiate(_launchKeyEquippablePrefab, character.transform.position, Quaternion.identity, character.transform).GetComponent <LaunchKeyEquippable>());
            character.SetGameplayState(CharacterGameplayState.LaunchKey);

            response.Accept();

            this.EmitSound(KeyPickupSoundKey);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="response"></param>
        protected override void OnPickup(PickupResponse response)
        {
            base.OnPickup(response);

            if (_powerUp.CanApply(response.character))
            {
                var emitor = Instantiate(_particleAttractor, transform.position, transform.rotation);
                emitor.SetTarget(response.character.transform);
                response.Accept();
                SpawnPickupText(_powerUpDescriptor.name);
                this.EmitSound(_powerUpDescriptor.pickupSounds);
                response.character.powerUpIds.Add(_powerUpDescriptor.powerUpId);
                _powerUp.Apply(response.character);
                Telemetry.game.Incr($"{_powerUpDescriptor.name}_pickup");
            }
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="response"></param>
        protected override void OnPickup(PickupResponse response)
        {
            base.OnPickup(response);

            if (response.character.GetComponent <NoSupplyPickupBuff>() != null)
            {
                return;
            }

            if (response.character.resources.supply >= response.character.resources.maxSupply)
            {
                response.character.resources.SupplyAnim(CharacterResources.SupplyAnimReason.Enough, true);
                return;
            }

            this.EmitSound($"{PickupSoundKey}{++response.character.resources.supply}");

            Telemetry.game.Incr("supply_pickup");

            response.Accept();
        }