コード例 #1
0
 public override void Restore()
 {
     if (Target != null)
     {
         Type         targetType = Target.GetType();
         PropertyInfo pI         = targetType.GetProperty(PropertyName);
         if (pI != null)
         {
             if (pI.CanWrite)
             {
                 pI.SetValue(Target, PropertyValue, null);
             }
             else if (Target is IDeletable && PropertyName == "IsDeleted")
             {
                 IDeletable deletable = (IDeletable)Target;
                 if ((bool)PropertyValue == true)
                 {
                     deletable.Delete();
                 }
                 else
                 {
                     deletable.Undelete();
                 }
             }
         }
     }
 }
コード例 #2
0
    public void Execute(Entity entity)
    {
        IDeletable del = entity as IDeletable;

        if (del != null)
        {
            del.Delete();
        }
    }
コード例 #3
0
ファイル: SpikeTarget.cs プロジェクト: Dracir/semicolon
    public virtual void OnCollisionEnter2D(Collision2D collision)
    {
        IDeletable deletable = collision.gameObject.GetComponent(typeof(IDeletable)) as IDeletable;

        if (deletable != null)
        {
            bool deleted = deletable.Delete(parent);
            if (deleted)
            {
                parent.Despawn();
            }
        }
        else
        {
            parent.Despawn();
        }
    }
コード例 #4
0
        public void Delete()
        {
            if (mInnerGroup.Controls.Count > 1)
            {
                if (MessageBox.Show("Delete " + this.GroupUI.Title, "Delete Group and contents?", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }
            }

            mOuterGroup.Controls.Remove(this);
            mTriggerNamespace.TriggerEditorData.UIData.mGroups.Remove(this.GroupUI);
            List <Control> markfordelete = new List <Control>();

            foreach (Control c in mInnerGroup.Controls)
            {
                markfordelete.Add(c);
            }

            foreach (Control c in markfordelete)
            {
                IDeletable d = c as IDeletable;
                if (d != null)
                {
                    d.Delete();
                }
            }
            mInnerGroup.Controls.Clear();



            foreach (IControlPoint p in mControlPoints)
            {
                p.MarkForDelete = true;
            }
            mHost.DeleteGroupTab(this.GroupUI.InternalGroupID);
            mHost.Refresh();
        }
コード例 #5
0
 public IActionResult Delete(int Id)
 {
     return(View(deletable.Delete(Id)));
 }
コード例 #6
0
 public virtual bool Remove(IDeletable entity)
 {
     entity.Delete();
     return(Update((T)entity));
 }
コード例 #7
0
 public bool Delete(string entityId) =>
 _deletable.Delete(entityId);
コード例 #8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject())
        {
            Ray        inputRay = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(inputRay, out hit))
            {
                TerrainData td = activeTerrain.terrainData;
                switch (actionMode)
                {
                case ModeAction.ADD:
                    Vector3 hitPoint = hit.point;
                    activeTerrain.AddTreeInstance(CreateTreeInstance(hitPoint.x / td.size.x, hitPoint.z / td.size.z));
                    break;

                case ModeAction.REMOVE:
                    IDeletable tree = hit.collider.gameObject.GetComponent <IDeletable>();
                    if (tree != null && hit.collider.gameObject.tag == "Tree")
                    {
                        tree.Delete();
                    }
                    break;

                case ModeAction.TOGGLE:
                    if (hit.collider.gameObject.tag == "Tree")
                    {
                        //Fire fire = hit.collider.GetComponentInChildren<Fire>();
                        IFlamable flammable = hit.collider.GetComponent <IFlamable>();
                        if (flammable == null)
                        {
                            break;
                        }
                        if (flammable.GetFlameState() == FlameState.BURNING)
                        {
                            flammable.SetFlameState(FlameState.NONE);
                        }
                        else
                        {
                            flammable.SetFlameState(FlameState.BURNING);
                        }
                        break;
                    }
                    if (hit.collider.gameObject.tag == "Fire")
                    {
                        IDeletable firepit = hit.collider.gameObject.GetComponent <IDeletable>();
                        if (firepit != null)
                        {
                            firepit.Delete();
                        }
                        break;
                    }
                    Instantiate(firepitPrefab, hit.point, Quaternion.identity, activeTerrain.transform);
                    break;

                default:
                    break;
                }
            }
        }
    }