public obj.IDestroyable FindNearestDestroyable(Vector3 from, obj.Types.Side side) { List <lr.obj.IDestroyable> destroyables = core.GOUtils.FindObjectsOfInterface <lr.obj.IDestroyable> (); List <lr.obj.IDestroyable> sortedDestroyables = new List <lr.obj.IDestroyable> (destroyables.FindAll(x => x.Side == side && x.Hp > 0)); sortedDestroyables.Sort(delegate(lr.obj.IDestroyable x, lr.obj.IDestroyable y) { if ((x.Position - from).sqrMagnitude < (y.Position - from).sqrMagnitude) { return(-1); } return(1); }); return(sortedDestroyables.Count > 0 ? sortedDestroyables [0] : null); }
public obj.CharacterVisual CreateCharacterBattleVisual(data.CharacterInstance fromInstance, battle.Context context, obj.Types.Side side) { GameObject visualGo = GameObject.Instantiate(fromInstance.BattleVisual) as GameObject; obj.CharacterVisual visual = visualGo.GetComponent <obj.CharacterVisual> (); visual.Init(context, fromInstance, side); return(visual); }
public void ReleaseCharacter(data.CharacterInstance charInstance, obj.Types.Side side) { obj.CharacterVisual charVisual = BattleFactory.CreateCharacterBattleVisual(charInstance, new Context(this), side); charVisual.Init(); }
public void ReleaseMissile(data.MissileInstance missileInstance, obj.Types.Side side) { obj.MissileVisual missileVisual = BattleFactory.CreateMissileBattleVisual(missileInstance, new Context(this), side); missileVisual.Init(); }
public obj.Tower GetTower(obj.Types.Side side) { return(Towers[(int)side]); }