public void SetSprite(WorkerModel model) { AgentAnim anim = null; if (model is AgentModel) { AgentUnit unit = AgentLayer.currentLayer.GetAgent(model.instanceId); anim = unit.animTarget; this.Symbol.gameObject.SetActive(true); } else if (model is OfficerModel) { OfficerUnit unit = OfficerLayer.currentLayer.GetOfficer(model.instanceId); anim = unit.animTarget; this.Symbol.gameObject.SetActive(false); } this.Face.sprite = anim.face.sprite; this.Hair.sprite = anim.hair.sprite; this.Body.sprite = anim.body.sprite; this.LeftDownArm.sprite = anim.B_low_arm.sprite; this.LeftUpArm.sprite = anim.B_up_arm.sprite; this.RightDownArm.sprite = anim.F_low_arm.sprite; this.RightUpArm.sprite = anim.F_up_arm.sprite; this.LeftDownLeg.sprite = anim.B_low_leg.sprite; this.LeftUpLeg.sprite = anim.B_up_leg.sprite; this.RightDownLeg.sprite = anim.F_low_leg.sprite; this.RightUpLeg.sprite = anim.F_up_leg.sprite; }
public static SuppressWindow CreateWindow(OfficerModel target) { if (currentWindow.gameObject.activeSelf) { if (currentWindow.target == target) { return(currentWindow); } } else { currentWindow.gameObject.SetActive(true); currentWindow.line.gameObject.SetActive(true); currentWindow.Activate(); } SuppressWindow inst = currentWindow; inst.target = target; inst.targetType = TargetType.OFFICER; if (inst.currentSefira != SefiraManager.instance.GetSefira(target.currentSefira)) { inst.currentSefira = SefiraManager.instance.GetSefira(target.currentSefira); inst.agentList.Clear(); } inst.InitAgentList(); inst.ShowAgentList(); OfficerUnit unit = OfficerLayer.currentLayer.GetOfficer(target.instanceId); inst.attachedPos = unit.transform; inst.ui.Init(target, inst.targetType); Canvas canvas = inst.transform.GetChild(0).GetComponent <Canvas>(); canvas.worldCamera = UIActivateManager.instance.GetCam(); currentWindow = inst; return(inst); }
public void Change(WorkerModel model) { spriteSet.SetSprite(model); Transform targetTransform = null; Sefira targetSefria = null; if ((targetSefria = SefiraManager.instance.GetSefira(model.currentSefira)) != null) { switch (targetSefria.name) { case "Malkut": if (model is AgentModel) { current = malkutAgent; } else { current = malkutOfficer; } break; default: current = malkutOfficer; break; } } if (model is AgentModel) { agentUnit = AgentLayer.currentLayer.GetAgent(model.instanceId); if (officerUnit != null) { officerUnit.gameObject.SetActive(false); } unit = agentUnit; targetTransform = (unit as AgentUnit).gameObject.transform; //(unit as AgentUnit).blockMoving = true; //model.movableNode = this.movableObject; } else if (model is OfficerModel) { officerUnit = OfficerLayer.currentLayer.GetOfficer(model.instanceId); if (agentUnit != null) { agentUnit.gameObject.SetActive(false); } unit = officerUnit; targetTransform = (unit as OfficerUnit).gameObject.transform; } level1SpriteRenderer.SetSprite(current); //targetTransform.SetParent(this.transform, true); /* * targetTransform.localPosition = reference.localPosition; * targetTransform.localScale = reference.localScale; * targetTransform.localRotation = reference.localRotation; */ /* * targetTransform.localPosition = Vector3.zero; * targetTransform.localScale = new Vector3(5, 5, 1); * targetTransform.localRotation = Quaternion.identity; */ }
public static SuppressWindow CreateNullCreatureSuppressWindow(CreatureModel nullCreature, WorkerModel model) { Debug.Log("NullCreature Suppress"); if (currentWindow.gameObject.activeSelf) { if (currentWindow.target == model) { return(currentWindow); } } else { currentWindow.gameObject.SetActive(true); currentWindow.line.gameObject.SetActive(true); currentWindow.Activate(); } SuppressWindow inst = currentWindow; inst.target = model; if (model is AgentModel) { inst.targetType = TargetType.AGENT; } else if (model is OfficerModel) { inst.targetType = TargetType.OFFICER; } Sefira modelSefira = nullCreature.sefira; if (inst.currentSefira != modelSefira) { inst.currentSefira = modelSefira; inst.agentList.Clear(); inst.SetSprites(modelSefira); } inst.InitAgentList(); inst.ShowAgentList(); CreatureUnit unit = CreatureLayer.currentLayer.GetCreature(nullCreature.instanceId); if (model is AgentModel) { AgentUnit agentUnit = AgentLayer.currentLayer.GetAgent(model.instanceId); inst.attachedPos = agentUnit.transform; inst.ui.Init(nullCreature, TargetType.CREATURE); } else if (model is OfficerModel) { OfficerUnit officerUnit = OfficerLayer.currentLayer.GetOfficer(model.instanceId); inst.attachedPos = officerUnit.transform; inst.ui.Init(nullCreature, TargetType.CREATURE); } if (inst.activatableObjectInitiated == false) { inst.UIActivateInit(); } Canvas canvas = inst.transform.GetChild(0).GetComponent <Canvas>(); canvas.worldCamera = UIActivateManager.instance.GetCam(); currentWindow = inst; Debug.Log("Null Creature's Window Opened"); return(inst); }