예제 #1
0
        IEnumerator ChangeMovement(bl_AttachType _type)
        {
            float     d    = 0;
            Transform tran = Positions.BarrelRoot.transform;

            if (_type == bl_AttachType.Foregrips)
            {
                tran = Positions.FeederRoot.transform;
            }
            else if (_type == bl_AttachType.Magazine)
            {
                tran = Positions.CylinderRoot.transform;
            }
            else if (_type == bl_AttachType.Sights)
            {
                tran = Positions.OpticsRoot.transform;
            }
            Vector3 v = tran.localPosition;

            while (d < 1)
            {
                d += Time.deltaTime / 0.2f;
                float t = ChangeMovementPath.Evaluate(d);
                tran.localPosition = Vector3.Lerp(v, v + new Vector3(0, t, 0), d);
                tran.localScale    = Vector3.Lerp(Vector3.zero, Vector3.one, d);
                yield return(null);
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="typ"></param>
        /// <param name="ID"></param>
        public void OnSelectAttachment(bl_AttachType typ, int ID)
        {
            if (CurrentCustomizer == null)
            {
                return;
            }

            CurrentCustomizer.ChangeAttachment(typ, ID);
            GetComponent <AudioSource>().PlayOneShot(OnChangeAttachmentSound);
        }
 public void Init(CustomizerModelInfo info, bl_AttachType typ, float d, bool selected)
 {
     Alpha       = GetComponent <CanvasGroup>();
     Alpha.alpha = 0;
     m_Text.text = info.Name;
     ID          = info.ID;
     m_Type      = typ;
     StartCoroutine(Fade(d));
     GetComponent <Button>().interactable = !selected;
 }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="list"></param>
 public void ChangeAttachWindow(List <CustomizerModelInfo> list, bl_AttachType type)
 {
     ClearUIList();
     for (int i = 0; i < list.Count; i++)
     {
         GameObject go = Instantiate(AttachButtonPrefab) as GameObject;
         go.SetActive(true);
         go.GetComponent <bl_AttachmentInfoButton>().Init(list[i], type, 0.1f * i, CurrentCustomizer.AttachmentsIDs[(int)type] == list[i].ID);
         go.transform.SetParent(AttachPanel, false);
         cacheButtons.Add(go);
     }
 }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 public void ChangeAttachment(bl_AttachType typ, int ID)
 {
     AttachmentsIDs[(int)typ] = ID;
     StopCoroutine("ChangeMovement");
     StartCoroutine("ChangeMovement", typ);
 }