private ObjectCtrl CopyObjectCtrl( IObjectInfo _dstObjectInfo, IObjectInfo _srcObjectInfo, ObjectCtrl _srcCtrl, ObjectCtrl _parent, CraftInfo _craftInfo, CraftInfo _srcCraftInfo) { if (_srcCtrl == null) { return((ObjectCtrl)null); } ObjectCtrl objectCtrl = (ObjectCtrl)null; switch (_dstObjectInfo.Kind) { case 0: objectCtrl = this.CopyObject(_dstObjectInfo as OIItem, _srcObjectInfo as OIItem, _srcCtrl.GameObject, _parent, _craftInfo, _srcCraftInfo); break; case 1: objectCtrl = this.CopyFolder(_dstObjectInfo as OIFolder, _srcObjectInfo as OIFolder, _srcCtrl as OCFolder, _parent, _craftInfo, _srcCraftInfo); break; } return(objectCtrl); }
private ObjectCtrl CopyFolder( OIFolder _oiFolder, OIFolder _srcOIFolder, OCFolder _srcOCFolder, ObjectCtrl _parent, CraftInfo craftInfo, CraftInfo _srcCraftInfo) { OCFolder ocFolder = new OCFolder(_oiFolder, _srcOCFolder.GameObject, craftInfo); if (_parent != null) { ocFolder.OnAttach(_parent, -1); } List <IObjectInfo> objectInfoList = new List <IObjectInfo>(); for (int index = 0; index < _oiFolder.Child.Count; ++index) { IObjectInfo _dstObjectInfo = _oiFolder.Child[index]; IObjectInfo objectInfo = _srcOIFolder.Child[index]; ObjectCtrl _srcCtrl; if (_srcOCFolder.Child.TryGetValue(objectInfo, out _srcCtrl)) { ocFolder.Child[_dstObjectInfo] = this.CopyObjectCtrl(_dstObjectInfo, objectInfo, _srcCtrl, (ObjectCtrl)ocFolder, craftInfo, _srcCraftInfo); } } return((ObjectCtrl)ocFolder); }
public override void Works(ObjectCtrl unit) { UnitCtrl unitCtrl = unit as UnitCtrl; if (target != null) { //Debug.Log(Vector2.Distance(unitCtrl.Pos, target.Pos)+"/"+ (unitCtrl.Stat("Radius") + target.Radius + 0.1f)); if (Vector2.Distance(unitCtrl.Pos, target.Pos) > unitCtrl.Stat("Radius") + target.Radius + 0.1f) { unitCtrl.MoveTarget(target); } else { Debug.Log("wow"); if (target.Type == eTargetType.Building && unitCtrl.Job == eUnitJob.Worker) { BuildingCtrl building = target.transform.GetComponent <BuildingCtrl>(); if (building.BuildingState == eBuildingState.Construction) { unitCtrl.receiptOrder(new Build(target)); } else { building.EnterBuilding(unitCtrl); } target = null; } unitCtrl.Stop(); } } }
public MoveCommand(ObjectCtrl _objectCtrl, Vector3 _old) { this.infos = new MoveCommand.Info[1] { new MoveCommand.Info(_objectCtrl, _old) }; }
private List <IObjectInfo> ChildrenOf(ObjectCtrl parent) { if (parent is OCFolder ocFolder) { return(ocFolder.OIFolder.Child); } return(parent != null ? parent.CraftInfo.ObjectInfos : Singleton <Manager.Housing> .Instance.CraftInfo.ObjectInfos); }
/// <summary> /// 유닛 선택 메서드 /// </summary> /// <param name="unit"></param> public void SelectObject(ObjectCtrl obj) { if (obj != null) { UnselectObject(); selectableObject.Add(obj); obj.SelectMesh.enabled = true; GameMng.Instance.interfaceMng.CreateInfomationInterface(); } }
void Start() { CheckScene(); myRoomUI = GameObject.Find("MyRoomUI"); mainCamera = GameObject.Find("MainCamera"); myroomCamera = GameObject.Find("MyRoomCamera"); objectCtrl = FindObjectOfType(typeof(ObjectCtrl)) as ObjectCtrl; //catUI = gameObject.GetComponent<CatUI>(); //objectCtrl = gameObject.GetComponent<ObjectCtrl>(); }
public override bool Achievement(ObjectCtrl unit) { UnitCtrl unitCtrl = unit as UnitCtrl; if (unitCtrl.X == targetPos.x && unitCtrl.Y == targetPos.y) { unitCtrl.Stop(); return(true); } return(false); }
public override bool Achievement(ObjectCtrl unit) { UnitCtrl unitCtrl = unit as UnitCtrl; if ((target.TargetObject as BuildingCtrl).BuildingState != eBuildingState.Construction) { unitCtrl.Stop(); return(true); } return(false); }
private static bool HousingObjectCtrl_PositionSetter(ObjectCtrl __instance, Vector3 value) { if (!_allowNegativeY.Value) { return(true); } __instance.Transform.position = value; __instance.LocalPosition = __instance.Transform.localPosition; return(false); }
public override bool Achievement(ObjectCtrl unit) { UnitCtrl unitCtrl = unit as UnitCtrl; if (target == null) { unitCtrl.Stop(); return(true); } target = unitCtrl.EnemyInView(); return(false); }
public override bool Achievement(ObjectCtrl unit) { UnitCtrl unitCtrl = unit as UnitCtrl; if (target == null) { Debug.Log("No"); unitCtrl.Stop(); return(true); } return(false); }
public void Do() { this.objectCtrl = (ObjectCtrl)Singleton <Manager.Housing> .Instance.AddObject(this.id); bool flag = Singleton <Manager.Housing> .Instance.CheckOverlap((ObjectCtrl)(this.objectCtrl as OCItem)); Singleton <CraftScene> .Instance.UICtrl.ListUICtrl.AddList(this.objectCtrl); if (flag) { Singleton <CraftScene> .Instance.UICtrl.ListUICtrl.RefreshList(); } Singleton <CraftScene> .Instance.UICtrl.AddUICtrl.Reselect(); }
public void Do() { ObjectCtrl target = this.target; switch (this.action) { case ItemDropAction.SetLastChild: foreach (ListDropCommand.Info info in this.infos) { info.ObjectCtrl.OnAttach(this.target, -1); } break; case ItemDropAction.SetPrevSibling: foreach (ListDropCommand.Info info in this.infos) { ObjectCtrl objectCtrl = info.ObjectCtrl; if (objectCtrl.Parent != target.Parent) { objectCtrl.OnAttach(target.Parent, -1); } List <IObjectInfo> objectInfoList = this.ChildrenOf(target.Parent); int num1 = objectInfoList.IndexOf(target.ObjectInfo); int num2 = objectInfoList.IndexOf(objectCtrl.ObjectInfo); objectInfoList.Remove(objectCtrl.ObjectInfo); objectInfoList.Insert(num1 <= num2 ? num1 : num1 - 1, objectCtrl.ObjectInfo); } break; case ItemDropAction.SetNextSibling: for (int index = this.infos.Length - 1; index >= 0; --index) { ObjectCtrl objectCtrl = this.infos[index].ObjectCtrl; List <IObjectInfo> objectInfoList = this.ChildrenOf(target.Parent); int num1 = objectInfoList.IndexOf(target.ObjectInfo); if (objectCtrl.Parent != target.Parent) { objectCtrl.OnAttach(target.Parent, num1 + 1); } else { int num2 = objectInfoList.IndexOf(objectCtrl.ObjectInfo); objectInfoList.Remove(objectCtrl.ObjectInfo); objectInfoList.Insert(num1 + (num1 >= num2 ? 0 : 1), objectCtrl.ObjectInfo); } } break; } }
private ObjectCtrl CopyObject( OIItem _oiItem, OIItem _srcOIFolder, GameObject _gameObject, ObjectCtrl _parent, CraftInfo craftInfo, CraftInfo _srcCraftInfo) { Manager.Housing.LoadInfo _loadInfo; if (!Singleton <Manager.Housing> .Instance.dicLoadInfo.TryGetValue(_oiItem.ID, out _loadInfo)) { return((ObjectCtrl)null); } return(Object.op_Equality((Object)_gameObject, (Object)null) ? (ObjectCtrl)null : (ObjectCtrl) new OCItem(_oiItem, _gameObject, craftInfo, _loadInfo)); }
public override void Works(ObjectCtrl unit) { UnitCtrl unitCtrl = unit as UnitCtrl; if (target != null) { if (Vector2.Distance(unitCtrl.Pos, target.Pos) < unitCtrl.Stat("AtkRange")) { unitCtrl.BuildTarget(target); } else { unitCtrl.MoveTarget(target); } } }
private static void HousingCommand_AddItemCommandDo(ObjectCtrl ___objectCtrl) { if (_placeAtSelection.Value && Singleton <Selection> .Instance.SelectObject != null) { ___objectCtrl.LocalPosition = Singleton <Selection> .Instance.SelectObject.LocalPosition; } if (_selectAddedObject.Value) { ObjectCtrl[] objectCtrls = new ObjectCtrl[1]; objectCtrls[0] = ___objectCtrl; Singleton <Selection> .Instance.SetSelectObjects(objectCtrls); Singleton <CraftScene> .Instance.UICtrl.ListUICtrl.VirtualizingTreeView.SelectedItems = objectCtrls; Singleton <CraftScene> .Instance.UICtrl.AddUICtrl.Reselect(); } }
public void CreateButtonClick() { PlayerCtrl ctrl = GameMng.Instance.playerMng.CtrlPlayer; if (ctrl.selectableObject.Count == 0) { InactiveSet(); } else if (ctrl.selectableObject[0] is UnitCtrl) { UnitCtrl unit = ctrl.selectableObject[0] as UnitCtrl; if (unit.Job == GameSys.Lib.eUnitJob.Worker) { BuilderSet(); beforeObject = ctrl.selectableObject[0]; } else { InactiveSet(); } } else if (ctrl.selectableObject[0] is BuildingCtrl) { if (ctrl.selectableObject[0].Owner == ctrl) { if (ctrl.selectableObject[0].Name == "BootCamp") { UnitCreateSet(); beforeObject = ctrl.selectableObject[0]; } else { BuilderSet(); beforeObject = ctrl.selectableObject[0]; } } } }
public override void Start(ObjectCtrl unit) { UnitCtrl unitCtrl = unit as UnitCtrl; unitCtrl.MovePos(targetPos); }
public void Do() { this.objectCtrl = Singleton <Manager.Housing> .Instance.AddFolder(); Singleton <CraftScene> .Instance.UICtrl.ListUICtrl.AddList(this.objectCtrl); }
public Info(ObjectCtrl _objectCtrl) { this.Source = _objectCtrl; }
public override void Start(ObjectCtrl unit) { Debug.Log("StartMoveTarget" + Target.name + Target.Pos); }
public Info(ObjectCtrl _objectCtrl) { this.ObjectCtrl = _objectCtrl; this.Parent = this.ObjectCtrl.Parent; this.Index = this.ObjectCtrl.InfoIndex; }
/// <summary> /// 명령 수행 메서드 /// </summary> /// <param name="unit"></param> public abstract void Works(ObjectCtrl unit);
/// <summary> /// 명령 달성 확인 메서드 /// </summary> /// <param name="unit"></param> /// <returns></returns> public abstract bool Achievement(ObjectCtrl unit);
public ListDropCommand(ItemDropArgs _args) { this.target = (ObjectCtrl)_args.DropTarget; this.action = _args.Action; this.infos = ((IEnumerable <object>)_args.DragItems).Select <object, ListDropCommand.Info>((Func <object, ListDropCommand.Info>)(v => new ListDropCommand.Info((ObjectCtrl)v))).ToArray <ListDropCommand.Info>(); }
public abstract void Start(ObjectCtrl unit);
public override void Works(ObjectCtrl unit) { }
public override void Start(ObjectCtrl unit) { }
public override bool Achievement(ObjectCtrl unit) { return(true); }