示例#1
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Edge")
     {
         MeleeWeaponEdge e = collision.gameObject.GetComponent <MeleeWeaponEdge>();
         if (e.playerHolding && e.swinging)
         {
             Damage(e.damage);
         }
     }
 }
示例#2
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "EnemyWeapon")
     {
         Physics.IgnoreCollision(collision.collider, GetComponent <CapsuleCollider>());
     }
     if (collision.gameObject.tag == "Edge")
     {
         MeleeWeaponEdge e = collision.gameObject.GetComponent <MeleeWeaponEdge>();
         if (e.playerHolding && e.swinging)
         {
             Damage(e.damage);
         }
     }
 }
示例#3
0
    public void Start()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        if (useLeftHand == UseLeftHand.Yes)
        {
            usingLeftHand = true;
        }
        animator  = transform.GetChild(0).GetComponent <Animator>();
        leftHand  = animator.transform.Find("LeftHand");
        rightHand = animator.transform.Find("RightHand");

        currentAmmo = maxInClipBullets;
        // if (isCloneWeapon)
        // {
        //     currentAmmo = cloneStartingCurrentAmmo;
        //     reloadBullets = cloneStartingReloadBullets;
        // }
        // else
        // {
        //     currentAmmo = maxInClipBullets;
        // }

        mesh   = animator.transform.Find("Mesh").gameObject;
        barrel = animator.transform.Find("Barrel");
        rb     = GetComponent <Rigidbody>();
        bc     = GetComponent <BoxCollider>();
        //By Aubrey, edge collider
        if (shootingMode == ShootingMode.Melee)
        {
            ec   = animator.transform.Find("Edge").gameObject.GetComponent <BoxCollider>();
            edge = animator.transform.Find("Edge").gameObject.GetComponent <MeleeWeaponEdge>();
        }
        audioS = GetComponent <AudioSource>();

        startPos[0] = leftHand.localPosition;
        startPos[1] = rightHand.localPosition;

        startRot[0] = leftHand.localRotation;
        startRot[1] = rightHand.localRotation;
    }
示例#4
0
 void OnCollisionEnter(Collision collision)
 {
     //ignore enemy weapon and normal ai collision
     if (!drone)
     {
         if (collision.gameObject.tag == "EnemyWeapon")
         {
             Physics.IgnoreCollision(collision.collider, GetComponent <CapsuleCollider>());
         }
     }
     //player melee weapon edge collision damage
     if (collision.gameObject.tag == "Edge")
     {
         MeleeWeaponEdge e = collision.gameObject.GetComponent <MeleeWeaponEdge>();
         if (e.playerHolding && e.swinging)
         {
             Damage(e.damage);
             ToggleGotHit();
         }
     }
 }