public void OnCollisionEnter2D(Collision2D coll) { lastCollistion = coll.collider; GameObject obj = coll.gameObject; switch (obj.tag) { case Config.TAG_CHAR: if (isBottom > 0) { return; } float delta = coll.contacts[0].point.y - (tf.position.y + centerY); if (delta < 0) { CharacterCell cell = obj.GetComponent <CharacterCell>(); if (cell.fontData.id == 95) { minX = 0; maxX = cell.fontData._actualWidth; } else { root = coll.transform.parent.GetComponent <CharacterGroup>(); minX = -root.pivot.x * root.textWidth; maxX = minX + root.textWidth; int curCharIdx = root._character.IndexOf(cell); for (int i = curCharIdx - 1; i > -1; i--) { if (root._character[i].fontData.id == 32 || root._character[i].fontData.id == 95) { minX = root._character[i].tf.localPosition.x + root._character[i].fontData._actualWidth; break; } } for (int i = curCharIdx + 1; i < root._character.Count; i++) { if (root._character[i].fontData.id == 32 || root._character[i].fontData.id == 95) { maxX = root._character[i].tf.localPosition.x; break; } } } onBottom(); tf.SetParent(obj.transform.parent, true); } break; } }
public static void numberInit(CharacterCell cell) { CharactersAction action = cell.tf.gameObject.AddComponent <CharactersAction>(); CharactersActionData d = new CharactersActionData(); d.actionType = Config.ColliderAction.Alpha; d.condition = Config.ActionTriggerCondition.Awake; d.duration = 1.0f; d.startAlpha = 1; d.endAlpha = 0; d.pauseTime = GlobalController.instance.setting.numberDisappearTime; d.pauseTime2 = int.Parse(cell.fontData.Name); d.loopType = LoopType.Yoyo; d.delay = d.pauseTime2; d.loop = 1; action.actionDataList.Add(d); action.trigger(Config.ActionTriggerCondition.Awake); }
public void OnCollisionEnter2D(Collision2D coll) { GameObject obj = coll.gameObject; switch (coll.gameObject.tag) { case Config.TAG_CHAR: float delta = coll.contacts[0].point.y - tf.position.y; CharacterCell cell = obj.GetComponent <CharacterCell>(); if (delta < 2) { if (isBottom <= 0) { onBottom(); tf.SetParent(obj.transform.parent, true); } cell.onPlayerLand(this); } else if (delta > height) { rb.velocity = new Vector2(rb.velocity.x, -rb.velocity.y); coll.transform.GetComponent <CharacterCell>().pushUp(); } break; case Config.TAG_MST: MonsterBase mst = obj.GetComponent <MonsterBase>(); if (tf.position.y > mst.tf.position.y + mst.centerY) { mst.hurt(999); rb.velocity = new Vector2(rb.velocity.x, -rb.velocity.y); } else { hurt(1); } break; } }
static void Main(string[] args) { TrinityConfig.CurrentRunningMode = RunningMode.Embedded; CastCell Jennifer = new CastCell("Jennifer Aniston", 43); CastCell Courteney = new CastCell("Courteney Cox", 43); CastCell Lisa = new CastCell("Lisa Kudrow", 43); CastCell Matt = new CastCell("Matt Le Blanc", 43); CastCell Matthew = new CastCell("Matthew Perry", 43); CastCell David = new CastCell("David Schwimmer", 43); CharacterCell Rachel = new CharacterCell("Rachel Green", 0); CharacterCell Monica = new CharacterCell("Monica Geller", 0); CharacterCell Phoebe = new CharacterCell("Phoebe Buffay", 0); CharacterCell Joey = new CharacterCell("Joey Tribbiani", 1); CharacterCell Chandler = new CharacterCell("Chandler Bing", 1); CharacterCell Ross = new CharacterCell("Ross Geller", 1); CastCell[] Casts = new CastCell[] { Jennifer, Courteney, Lisa, Matt, Matthew, David }; CharacterCell[] Characters = new CharacterCell[] { Rachel, Monica, Phoebe, Joey, Chandler, Ross }; int cell_id = 0; for (int i = 0; i < Casts.Length; i++) { Global.LocalStorage.SaveCastCell(cell_id++, Casts[i]); } for (int i = 0; i < Characters.Length; i++) { Global.LocalStorage.SaveCharacterCell(cell_id++, Characters[i]); } //FriendsRelation friends_relation = new FriendsRelation( // new List<long>( // ); }
public static void rightBraceInit(CharacterCell cell) { BraceFeature b = cell.tf.gameObject.AddComponent <BraceFeature>(); b.direction = Config.Direction.Right; }
public static void angleBracketUpTrigger(PhysicalPlayerController pp, CharacterCell cell) { cell.tf.DOLocalMoveY(cell.tf.localPosition.y - 5, 0.1f).SetLoops(2, LoopType.Yoyo); pp.Rebound(Config.Direction.None); }
public static void underLineTriggerHandler(PhysicalPlayerController pp, CharacterCell cell) { pp.tf.SetParent(cell.tf); }
public static void atInit(CharacterCell cell) { cell.gameObject.AddComponent <AtShootFeature>(); }
public static void underLineInit(CharacterCell cell) { cell.gameObject.AddComponent <UnderLineMove>(); }