示例#1
0
    protected RagdollControls targetRagdoll; //The target's Ragdoll Controls component

    public override void OnPickUp(GameObject target)
    {
        //Get Components
        targetWeaponAgent = target.GetComponent <WeaponAgent>();
        targetRagdoll     = target.GetComponent <RagdollControls>();

        //If they can hold a weapon
        if (targetWeaponAgent != null)
        {
            //Unequip their last weapon
            targetWeaponAgent.Unequip();

            //Equip the new weapon
            targetWeaponAgent.EquipWeapon(weapon);

            //Run the base pickup on pickup
            base.OnPickUp(target);

            //Reset their colliders to include the weapon
            if (targetRagdoll != null)
            {
                targetRagdoll.partColliders[targetRagdoll.partColliders.Count - 1] = targetWeaponAgent.equippedWeapon.GetComponent <Collider>();
            }
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        if (theType == WeaponType.HANDGUN)
        {
            ammo    = 12;
            maxAmmo = 120;
        }
        if (theType == WeaponType.RIFLE)
        {
            ammo    = 30;
            maxAmmo = 150;
        }

        // this is a messy way to do this, ask for the animator and get the gameobject, need another way
        if (gameObject.GetComponentInParent <Animator>().gameObject.CompareTag("AI"))
        {
            parentObj = GetComponentInParent <Animator> ().gameObject;
            theAgent  = (WeaponAgent)parentObj.GetComponent <AIWeaponHandler> ();
            return;
        }

        if (gameObject.GetComponentInParent <Animator>().gameObject.CompareTag("Player"))
        {
            parentObj = GetComponentInParent <Animator> ().gameObject;
            theAgent  = (WeaponAgent)parentObj.GetComponent <Player> ();
            return;
        }
    }
示例#3
0
文件: Health.cs 项目: Darpaler/GPE340
    public bool died = false;           //Weather the pawn is dead or not

    // Use this for initialization
    void Start()
    {
        //Get Components
        healthBar   = gameObject.GetComponentInChildren <Slider>();
        ragdoll     = gameObject.GetComponent <RagdollControls>();
        weaponAgent = gameObject.GetComponent <WeaponAgent>();

        //Set health bar max
        healthBar.maxValue = maxHealth;

        //Set health to max
        health = maxHealth;
    }
示例#4
0
 void Start()
 {
     //Get Components
     weaponAgent = gameObject.transform.parent.parent.GetComponent <WeaponAgent>();
 }
示例#5
0
文件: Health.cs 项目: Crawdunk/gpe340
 void Awake()
 {
     agent = GetComponent <WeaponAgent>();
 }
示例#6
0
 protected override void OnTriggerEnter(Collider collider)
 {
     weaponAgent = collider.gameObject.GetComponent <WeaponAgent>();
     base.OnTriggerEnter(collider);
 }