Example #1
0
    public virtual void OnTriggerEnter(Collider col)
    {
        if (this.mover && this.mover.enabled)
        {
            return;
        }
        ThirdPersonStatus playerStatus = (ThirdPersonStatus)col.GetComponent(typeof(ThirdPersonStatus));

        if (this.used || (playerStatus == null))
        {
            return;
        }
        if (!this.ApplyPickup(playerStatus))
        {
            return;
        }
        this.used = true;
        if (this.sound)
        {
            AudioSource.PlayClipAtPoint(this.sound, this.transform.position, this.soundVolume);
        }
        if (this.GetComponent <Animation>() && this.GetComponent <Animation>().clip)
        {
            this.GetComponent <Animation>().Play();
            UnityEngine.Object.Destroy(this.gameObject, this.GetComponent <Animation>().clip.length);
        }
        else
        {
            UnityEngine.Object.Destroy(this.gameObject);
        }
    }
Example #2
0
    // Cache link to player's state management script for later use.
    void Awake()
    {
        playerInfo = (ThirdPersonStatus)FindObjectOfType(typeof(ThirdPersonStatus));

        if (!playerInfo)
            Debug.Log("No link to player's state manager.");
    }
Example #3
0
 // Cache link to player's state management script for later use.
 public virtual void Awake()
 {
     this.playerInfo = (ThirdPersonStatus)UnityEngine.Object.FindObjectOfType(typeof(ThirdPersonStatus));
     if (!this.playerInfo)
     {
         Debug.Log("No link to player's state manager.");
     }
 }
Example #4
0
    public virtual bool ApplyPickup(ThirdPersonStatus playerStatus)
    {
        switch (this.pickupType)
        {
        case PickupType.Health:
            playerStatus.AddHealth(this.amount);
            break;

        case PickupType.FuelCell:
            playerStatus.FoundItem(this.amount);
            break;
        }
        return(true);
    }