Exemple #1
0
    public bool UsePickup(PlayerController pc)
    {
        if (pc.WillColliderHeightCollide(transform.position, Settings.GetCombinedGroupWithPlayer(pc).CharacterSettings.ColliderHeight))
        {
            FailureIndicator.ShowFailureMessage("Not Enough Room", transform.position);
            return(false);
        }

        if (Settings.GetCombinedGroupWithPlayer(pc) == pc.CurrentSetting)
        {
            FailureIndicator.ShowFailureMessage("Already Have That Body Part", transform.position);
            return(false);
        }

        var overlap = Settings.GetOverlapGroupWithPlayer(pc);

        Settings.ApplyToPlayer(pc);
        pc.SetPositionToPickup(this);

        if (overlap.Head || overlap.Torso || overlap.Legs)
        {
            Settings = overlap;
        }
        else
        {
            Destroy(gameObject);
        }
        AudioManager.PlayOneShot(GameSettings.PickupPartSFX);
        return(true);
    }
Exemple #2
0
    private void DiscardPowerup()
    {
        if (CurrentSetting.GetNumPowerups() <= 1)
        {
            FailureIndicator.ShowFailureMessage("No Body Part To Drop", transform.position);
            return;
        }
        AudioManager.PlayOneShot(GameSettings.DiscardPartSFX);
        int ind = 1;

        if (CurrentSetting.Head)
        {
            SpawnPickup(SkeletonSettingGrouping.FindGroupingSetting(true, false, false, false), ind++);
            SkeletonSettingGrouping.FindGroupingSetting(false, CurrentSetting.Torso, CurrentSetting.Legs, CurrentSetting.Wings).ForceApplyToPlayer(this);
            return;
        }
        if (CurrentSetting.Torso)
        {
            SpawnPickup(SkeletonSettingGrouping.FindGroupingSetting(false, true, false, false), ind++);
            SkeletonSettingGrouping.FindGroupingSetting(CurrentSetting.Head, false, CurrentSetting.Legs, CurrentSetting.Wings).ForceApplyToPlayer(this);
            return;
        }
        if (CurrentSetting.Legs)
        {
            SpawnPickup(SkeletonSettingGrouping.FindGroupingSetting(false, false, true, false), ind++);
            SkeletonSettingGrouping.FindGroupingSetting(CurrentSetting.Head, CurrentSetting.Torso, false, CurrentSetting.Wings).ForceApplyToPlayer(this);
            return;
        }
        if (CurrentSetting.Wings)
        {
            SpawnPickup(SkeletonSettingGrouping.FindGroupingSetting(false, false, false, true), ind++);
            SkeletonSettingGrouping.FindGroupingSetting(CurrentSetting.Head, CurrentSetting.Torso, CurrentSetting.Legs, false).ForceApplyToPlayer(this);
            return;
        }

        //Just in case
        GameSettings.GhostSetting.ForceApplyToPlayer(this);
    }
Exemple #3
0
 private void Awake()
 {
     _instance = this;
 }