Пример #1
0
    void Update()
    {
        if (cursorCotroll)
        {
            GameManager.controlls.SetCursor(Cursors.Arrow);
            cursorCotroll = false;
        }

        if (unit.cSelectable.selected && Input.GetKey(KeyCode.LeftControl) && GameManager.controlls.holdOverObject != null)
        {
            transport = GameManager.controlls.holdOverObject.GetComponent <Transport>();
            if (transport != null)
            {
                if (transport.CanAdd(this) && transport.unit.team == this.unit.team)
                {
                    GameManager.controlls.SetCursor(Cursors.Load);
                    cursorCotroll = true;

                    if (Input.GetMouseButtonDown(1))
                    {
                        targetPosition = transport.embarkPosition.position;
                        unit.cMoveable.SetTarget(targetPosition);
                    }
                }
                else
                {
                    GameManager.controlls.SetCursor(Cursors.LoadBlocked);
                    cursorCotroll = true;
                }
            }
        }
        if (targetPosition != Vector3.zero && transport != null)
        {
            if (targetPosition == unit.cMoveable.GetCurrentTarget())
            {
                targetEmbarkPosition.Set(transform.position.x, transport.embarkPosition.position.y, transform.position.z);
                if (Vector3.Distance(targetEmbarkPosition, transport.embarkPosition.position) < 1)
                {
                    transport.Add(this);
                    targetPosition = Vector3.zero;
                    transport      = null;
                }
                else if (!transport.CanAdd(this))
                {
                    targetPosition = Vector3.zero;
                    transport      = null;
                    unit.cMoveable.ClearTarget();
                }
            }
            else
            {
                targetPosition = Vector3.zero;
                transport      = null;
            }
        }
    }
Пример #2
0
        public void Test2() //DeleteFirstEven and Delete and Add
        {
            Transport tr = new Transport();

            tr = tr.MakeList(6);
            tr = tr.DeleteFirstEven(tr);
            Assert.AreEqual(5, Count(tr));

            tr = tr.Delete(tr, 2);
            Assert.AreEqual(4, Count(tr));

            tr = tr.Delete(tr, 6);
            Assert.AreEqual(4, Count(tr));

            tr = tr.Add(tr, 3);
            Assert.AreEqual(5, Count(tr));

            tr = tr.Add(tr, 7);
            Assert.AreEqual(5, Count(tr));
        }
Пример #3
0
 public ActionResult Create(Transport AddTransport)
 {
     Transport.Add(AddTransport);
     return(RedirectToAction("List"));
 }