public void Follow(PhysEntity phys, int ind)
        {
            isFollowing    = true;
            isOn           = true;
            followingIndex = ind;

            Center(phys.pos);
        }
示例#2
0
 public void Harvest(PhysEntity targetEnt, int ind)
 {
     Approach(targetEnt, ind);
     subjectEntity     = targetEnt;
     approaching       = true;
     miningEnabled     = false;
     dockingEnabled    = false;
     harvestingEnabled = true;
 }
示例#3
0
        public void Approach(PhysEntity target, int ind)
        {
            float x = (float)((target.pos.X - pos.X) / (target.pos - pos).Length() * (target.diam / 2 + 25));
            float y = (float)((target.pos.Y - pos.Y) / (target.pos - pos).Length() * (target.diam / 2 + 25));

            targetPhysEnt = target;
            targetIndex   = ind;
            UpdateTarget(-(new Vector2(x, y)) + target.pos);
        }
 public void ChangeTarget(PhysEntity selected)
 {
     isOn = true;
     if (follow != null)
     {
         follow.UpdateEvent -= follow_updateEvent;
         follow.RadialMenuFollowingOnOff(false);
     }
     follow              = selected;
     follow.UpdateEvent += follow_updateEvent;
     follow.RadialMenuFollowingOnOff(true);
     isFollowing = true;
 }
示例#5
0
        public void ReceiveOrder(int order, Vector2 targetPt, PhysEntity targetEnt = null, int targetInd = 0)
        {
            //orderState
            switch (order)
            {
            case 0:
                orderState = 0;
                if (targetEnt != null)
                {
                    Approach(targetEnt, targetInd);
                    miningEnabled  = false;
                    dockingEnabled = false;
                    approaching    = true;
                }
                else
                {
                    ApproachPt(targetPt);
                    targetIndex    = 0;
                    miningEnabled  = false;
                    dockingEnabled = false;
                    approaching    = false;
                }
                break;

            case 1:
                orderState = 1;
                Mine(targetEnt, targetInd);
                break;

            case 2:
                orderState = 2;
                Harvest(targetEnt, targetInd);
                break;

            case 3:
                orderState = 3;
                Harpoon(targetEnt, targetInd);
                break;
            }
        }
 public void Update(PhysEntity selected, Clickable focus = null)
 {
     Center(selected.pos);
 }
示例#7
0
 public _selectedPhysEnt(int ind, PhysEntity ent)
 {
     index  = ind;
     entity = ent;
 }