public void SetActiveEntity(EntityWidgetManager entityWidget)
 {
     if (this.ActiveEntity != null)//Deactivate old entity
     {
         this.ActiveEntity.IsActive = false;
     }
     //Activate new one
     this.ActiveEntity          = entityWidget;
     this.ActiveEntity.IsActive = true;
 }
        public void ShowAnimationOn(GameObject animation, Entity entity)
        {
            EntityWidgetManager ewm = this.entityToWidgetMap[entity];

            if (ewm == null)
            {
                throw new System.Exception("EWM not found");
            }
            GameObject anim = Instantiate(animation, GameObject.Find("/Canvas").transform);

            anim.transform.position = ewm.transform.position;
        }
Exemplo n.º 3
0
    private void CreateChild(Entity entity)
    {
        GameObject child = Instantiate(this.EntityPrefab, transform);

        children.Add(child);
        EntityWidgetManager childEWM = child.GetComponent <EntityWidgetManager>();

        childEWM.SetData(entity);
        //Assign on click action to entities
        childEWM.OnClick = () => { this.EntityClicked(entity); };
        childEWM.OnHeld  = () => { this.EntityHeld(entity); };
        this.missionLayoutManager.ActiveGameState.CreateLink(entity, childEWM);
    }
 public void TargetEntity(EntityWidgetManager entityWidget)
 {
     if (this.Target != null)
     {
         this.Target.IsHighlighted = false;
     }
     if (this.Target == entityWidget)//Clicked same target twice
     {
         this.Target = null;
     }
     else//Different target
     {
         entityWidget.IsHighlighted = true;
         this.Target = entityWidget;
     }
 }
 private void UpdateMainWidget(EntityState entityState, EntityWidgetManager widget)
 {
     widget.SetData(entityState);
 }
 ///<summary>Creates a link between Entity and its Widget</summary>
 public void CreateLink(Entity entity, EntityWidgetManager entityWidgetManager)
 {
     this.entityToWidgetMap.Add(entity, entityWidgetManager);
 }