private void Damage()
 {
     if (null == currentlyDamagedBone || !currentlyDamagedBone.HasAttachedItem)
     {
         currentlyDamagedBone = dropItemArea.GetRandomUsedAttachmentPoint();
     }
     if (null != currentlyDamagedBone)
     {
         currentlyDamagedBone.Damage(1.0f);
         if (!currentlyDamagedBone.HasAttachedItem)
         {
             dropItemArea.DettachHat();
             if (null == dropItemArea.GetRandomUsedAttachmentPoint())
             {
                 OnZombieDied();
             }
             currentlyDamagedBone = null;
         }
         StartCoroutine(WaitBeforeDamagePossibleAgain());
     }
     else
     {
         OnZombieDied();
     }
 }
    private void OnSceneGUI()
    {
        attach          = target as ItemAttachmentPoint;
        handleTransform = attach.transform;
        handleRotation  = Tools.pivotRotation == PivotRotation.Local ?
                          handleTransform.rotation : Quaternion.identity;

        Vector3 p0 = handleTransform.position;
        Vector3 p1 = ShowPoint(0);
        Vector3 p2 = ShowPoint(1);
        Vector3 p3 = ShowPoint(2);

        Handles.color = Color.grey;
        Handles.DrawLine(p0, p1);
        Handles.DrawLine(p2, p3);

        Vector3 linestart = attach.transform.TransformPoint(attach.GetLocalPoint(0));

        for (int i = 0; i <= (attach.numerOfItems - 1); i++)
        {
            Vector3 lineEnd = attach.transform.TransformPoint(attach.GetLocalPoint(i / (float)(attach.numerOfItems - 1)));
            Handles.color = Color.white;
            Handles.DrawLine(linestart, lineEnd);
            Handles.color = Color.green;
            Handles.DrawLine(lineEnd, lineEnd + attach.GetVelocity(i / (float)(attach.numerOfItems - 1)) * 0.5f);
            linestart = lineEnd;
        }
    }
예제 #3
0
    public void AttachItem(PickupItem item)
    {
        ItemAttachmentPoint attachmentPoint = FindRandomFreeAttachmentPoint();

        if (null != attachmentPoint)
        {
            attachmentPoint.AttachItem(item);
        }
    }