public void OnPos(GameEntity entity, LVector2 newPosition) { var dst = newPosition.ToVector3(); var src = transform.localPosition; transform.localPosition = dst;// Vector3.Lerp(src, dst, 0.3f); }
public void CreateEffect(GameObject prefab, LVector2 pos) { if (prefab == null) { return; } var liveTime = prefab.GetComponent <IRollbackEffect>().LiveTime; var comp = new EffectProxy(); GameObject go = null; if (!_constStateService.IsVideoLoading) { go = GameObject.Instantiate(prefab, transform.position + pos.ToVector3(), Quaternion.identity); } if (tail == null) { head = tail = comp; } else { comp.pre = tail; tail.next = comp; tail = comp; } comp.DoStart(CurTick, go?.GetComponent <IRollbackEffect>(), liveTime); }
public void BindView(IEntity entity, short assetId, LVector2 createPos, int deg = 0) { var prefab = Resources.Load <GameObject>(_resService.GetAssetPath(assetId)); var go = GameObject.Instantiate(prefab, transform.position + createPos.ToVector3(), Quaternion.Euler(0, 0, deg), transform); go.AddComponent <PosListener>(); go.AddComponent <DirListener>(); BindView(entity as GameEntity, go); }
public void BindView(object entity, ushort assetId, LVector2 createPos, int deg = 0) { var path = _resService.GetAssetPath(assetId); if (string.IsNullOrEmpty(path)) { return; } var prefab = Resources.Load <GameObject>(path); var go = GameObject.Instantiate(prefab, transform.position + createPos.ToVector3(), Quaternion.Euler(0, deg, 0), transform); BindView(entity as GameEntity, go); }
private GameEntity CreateUnit <T>(LVector2 createPos, List <T> prefabLst, int type, EDir dir, Transform parent) where T : GameConfig.Unit { var ecsPrefab = prefabLst[type]; var assetId = ecsPrefab.asset.assetId; var prefab = Resources.Load <GameObject>(GameConfig.GetAssetPath(assetId)); var go = GameObject.Instantiate(prefab, transform.position + createPos.ToVector3(), Quaternion.identity, parent); go.AddComponent <PosListener>(); go.AddComponent <DirListener>(); var entity = CreateGameEntity(); _viewService.BindView(entity, _gameContext, go); ecsPrefab.SetComponentsTo(entity); entity.dir.value = dir; entity.pos.value = createPos; return(entity); }
void CreateEffect(GameObject prefab, LVector2 pos) { var go = GameObject.Instantiate(prefab, transform.position + pos.ToVector3(), Quaternion.identity); var comp = go.GetComponent <RollbackableRes>(); if (comp != null) { if (tail == null) { head = tail = comp; } else { comp.pre = tail; tail.next = comp; tail = comp; } comp.DoStart(CurTick); } }
public void ShowBornEffect(LVector2 pos) { GameObject.Instantiate(_config.BornPrefab, transform.position + pos.ToVector3(), Quaternion.identity); }
// Token: 0x06000092 RID: 146 RVA: 0x00005504 File Offset: 0x00003704 public void CreateEffect(GameObject prefab, LVector2 pos) { bool flag = prefab == null; if (!flag) { LFloat liveTime = prefab.GetComponent <IRollbackEffect>().LiveTime; EffectProxy effectProxy = new EffectProxy(); GameObject gameObject = null; bool flag2 = !this._globalStateService.IsVideoLoading; if (flag2) { gameObject = Object.Instantiate <GameObject>(prefab, base.transform.position + pos.ToVector3(), Quaternion.identity); } bool flag3 = this.tail == null; if (flag3) { this.head = (this.tail = effectProxy); } else { effectProxy.pre = this.tail; this.tail.next = effectProxy; this.tail = effectProxy; } effectProxy.DoStart(base.CurTick, (gameObject != null) ? gameObject.GetComponent <IRollbackEffect>() : null, liveTime); } }