Exemple #1
0
        private void StartPendle(IUnitFacade steerer)
        {
            steerer.DisableMovementOrders();
            steerer.Wait(null);

            var curParent = steerer.transform.parent;
            var rb        = steerer.gameObject.GetComponent <Rigidbody>();

            if (this.isOnboardTrigger)
            {
                rb.isKinematic           = true;
                steerer.transform.parent = pendler.transform;
            }

            pendler.MoveTo(
                this.movesTo,
                () =>
            {
                if (this.isOnboardTrigger)
                {
                    steerer.transform.parent = curParent;
                    rb.isKinematic           = false;
                }
                else
                {
                    steerer.EnableMovementOrders();
                }

                steerer.Resume();
            });
        }