public override void FindFrame() { PineTree pineTree1 = Level.CheckPoint <PineTree>(this.x - 8f, this.y, (Thing)this); if (pineTree1 != null && pineTree1._tileset != this._tileset) { pineTree1 = (PineTree)null; } PineTree pineTree2 = Level.CheckPoint <PineTree>(this.x + 8f, this.y, (Thing)this); if (pineTree2 != null && pineTree2._tileset != this._tileset) { pineTree2 = (PineTree)null; } if (pineTree1 != null && pineTree2 != null) { pineTree1.FindFrame(); } else { if (pineTree1 != null) { return; } List <PineTree> pineTreeList = new List <PineTree>(); PineTree pineTree3 = this; this.leftPine = (PineTree)null; while (pineTree3 != null) { pineTreeList.Add(pineTree3); pineTree3.rightPine = pineTree2; if (pineTree2 != null) { pineTree2.leftPine = pineTree3; pineTree3 = pineTree2; pineTree2 = Level.CheckPoint <PineTree>(pineTree2.x + 8f, pineTree2.y, (Thing)pineTree2); } else { break; } } bool flag = pineTreeList.Count % 2 == 0; foreach (PineTree pineTree4 in pineTreeList) { int num1 = pineTreeList.Count / 2; int num2 = pineTreeList.IndexOf(pineTree4); pineTree4.orientation = !flag ? (num2 != num1 ? (num2 >= num1 ? 1 : -1) : 0) : (num2 >= num1 ? 1 : -1); pineTree4.SpecialFindFrame(); } } }
public void SpecialFindFrame() { PineTree leftPine = this.leftPine; PineTree rightPine = this.rightPine; PineTree pineTree1 = Level.CheckPoint <PineTree>(this.x, this.y - 16f, (Thing)this); PineTree pineTree2 = Level.CheckPoint <PineTree>(this.x, this.y + 16f, (Thing)this); if (pineTree1 != null && pineTree1._tileset != this._tileset) { pineTree1 = (PineTree)null; } if (pineTree2 != null && pineTree2._tileset != this._tileset) { pineTree2 = (PineTree)null; } if (pineTree1 != null) { if (rightPine != null) { if (pineTree2 != null) { if (leftPine != null) { if (this.orientation == 0) { if (leftPine.leftPine == null && rightPine.rightPine == null) { this.frame = 1; } else { this.frame = 10; } } else if (this.orientation == -1) { if (leftPine.leftPine == null) { this.frame = 22; } else { this.frame = 23; } } else { if (this.orientation != 1) { return; } if (rightPine.rightPine == null) { this.frame = 26; } else { this.frame = 25; } } } else { this.frame = 0; } } else if (leftPine != null) { if (this.orientation == 0) { if (leftPine.leftPine == null && rightPine.rightPine == null) { this.frame = 1; } else { this.frame = 10; } } else if (this.orientation == -1) { if (leftPine.leftPine == null) { this.frame = 8; } else { this.frame = 9; } } else { if (this.orientation != 1) { return; } if (rightPine.rightPine == null) { this.frame = 12; } else { this.frame = 11; } } } else { this.frame = 3; } } else if (pineTree2 != null) { if (leftPine != null) { this.frame = 2; } else { this.frame = 5; } } else if (leftPine != null) { this.frame = 4; } else { this.frame = 5; } } else if (rightPine != null) { if (pineTree2 != null) { if (leftPine != null) { if (this.orientation == 0) { if (leftPine.leftPine == null && rightPine.rightPine == null) { this.frame = 1; } else { this.frame = 31; } } else if (this.orientation == -1) { if (leftPine.leftPine == null) { this.frame = 29; } else { this.frame = 30; } } else { if (this.orientation != 1) { return; } if (rightPine.rightPine == null) { this.frame = 33; } else { this.frame = 32; } } } else { this.frame = 0; } } else if (leftPine != null) { if (this.orientation == 0) { if (leftPine.leftPine == null && rightPine.rightPine == null) { this.frame = 1; } else { this.frame = 17; } } else if (this.orientation == -1) { if (leftPine.leftPine == null) { this.frame = 15; } else { this.frame = 16; } } else { if (this.orientation != 1) { return; } if (rightPine.rightPine == null) { this.frame = 19; } else { this.frame = 18; } } } else { this.frame = 3; } } else if (pineTree2 != null) { if (leftPine != null) { this.frame = 2; } else { this.frame = 5; } } else if (leftPine != null) { this.frame = 4; } else { this.frame = 5; } }