예제 #1
0
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is DActionIndicator))
            {
                return(false);
            }
            DActionIndicator dActionIndicator = obj as DActionIndicator;

            if (string.IsNullOrEmpty(dActionIndicator.IndicatorId))
            {
                return(false);
            }
            return(IndicatorId.Equals(dActionIndicator.IndicatorId));
        }
예제 #2
0
        private DActionIndicator getIndicatorByID(string indicatorID)
        {
            DActionIndicator result = null;

            foreach (DActionIndicator key in actionIndicators.Keys)
            {
                if (key.IndicatorId == indicatorID)
                {
                    result = key;
                    break;
                }
            }
            return(result);
        }
예제 #3
0
        private bool actionIndicatorRemoved(ActionIndicatorEvents.RemoveActionIndicator evt)
        {
            DActionIndicator indicatorByID = getIndicatorByID(evt.IndicatorData.IndicatorId);

            if (indicatorByID != null && actionIndicators.ContainsKey(indicatorByID))
            {
                if (actionIndicators[indicatorByID] != null)
                {
                    Object.Destroy(actionIndicators[indicatorByID]);
                }
                actionIndicators.Remove(indicatorByID);
            }
            return(false);
        }
예제 #4
0
        private IEnumerator loadActionIndicator(DActionIndicator indicatorData)
        {
            AssetRequest <GameObject> assetRequest = Content.LoadAsync <GameObject>(indicatorData.IndicatorContentKey);

            actionIndicators[indicatorData] = null;
            yield return(assetRequest);

            if (indicatorData.TargetTransform != null && !indicatorData.TargetTransform.gameObject.IsDestroyed())
            {
                DActionIndicator indicatorByID = getIndicatorByID(indicatorData.IndicatorId);
                if (indicatorByID != null)
                {
                    GameObject gameObject = Object.Instantiate(assetRequest.Asset);
                    gameObject.transform.SetParent(indicatorData.TargetTransform);
                    gameObject.transform.localPosition = indicatorData.TargetOffset;
                    actionIndicators[indicatorData]    = gameObject;
                }
            }
        }
예제 #5
0
 private void SetTargets()
 {
     if (Target1 != null)
     {
         DActionIndicator dActionIndicator = new DActionIndicator();
         dActionIndicator.IndicatorContentKey = "Prefabs/ActionIndicators/ActionIndicatorArrow";
         dActionIndicator.TargetTransform     = Target1;
         dActionIndicator.TargetOffset        = new Vector3(0f, 1f, 0f);
         Service.Get <EventDispatcher>().DispatchEvent(new ActionIndicatorEvents.AddActionIndicator(dActionIndicator));
     }
     if (Target2 != null)
     {
         DActionIndicator dActionIndicator2 = new DActionIndicator();
         dActionIndicator2.IndicatorContentKey = "Prefabs/ActionIndicators/ActionIndicatorArrow";
         dActionIndicator2.TargetTransform     = Target2;
         dActionIndicator2.TargetOffset        = new Vector3(0f, 1f, 0f);
         Service.Get <EventDispatcher>().DispatchEvent(new ActionIndicatorEvents.AddActionIndicator(dActionIndicator2));
     }
 }