public void DelOneBody() { if (allBody.Count == 0) { return; } PlayerSnackBody psb = allBody.Last(); psb.target = null; psb.Visible = false; psb.isOn = false; allBody.Remove(psb); if (allBody.Count != 0) { lastBody = allBody.Last(); } else { lastBody = null; } }
public void AddOneBody(ConsoleColor color = ConsoleColor.Yellow) { PlayerSnackBody psb = new PlayerSnackBody(); NowScene.Ins.AddObjectToNowScene(psb); psb.Init(); if (lastBody == null) { psb.target = this; psb.followHead = true; psb.player = this; } else { psb.target = lastBody; psb.player = this; } allBody.Add(psb); for (int i = 0; i < allBody.Count; i++) { if (i % 2 == 0) { allBody[i].FColor = ConsoleColor.White; } else { allBody[i].FColor = color; } allBody[i].Init(); } lastBody = psb; }