internal void DetachMoveState(bool destroyEntity)
            {
                if (moveEntity == null)
                {
                    return;
                }

                if (unit.IsOwner)
                {
                    moveState.RemoveCallback(nameof(IUnitState.MovementFlags), OnMoveStateFlagsChanged);
                }

                if (destroyEntity)
                {
                    if (!moveEntity.IsOwner || !moveEntity.IsAttached)
                    {
                        Destroy(moveEntity.gameObject);
                    }
                    else
                    {
                        BoltNetwork.Destroy(moveEntity.gameObject);
                    }
                }

                moveEntity = null;
                moveState  = null;
            }
예제 #2
0
        public void DetachMoveState(bool destroyObject)
        {
            if (clientMoveEntity == null)
            {
                return;
            }

            if (Unit.IsOwner)
            {
                clientMoveState.RemoveCallback(nameof(IUnitState.MovementFlags), OnLocalMoveStateFlagsChanged);
            }

            if (destroyObject)
            {
                if (!clientMoveEntity.IsOwner || !clientMoveEntity.IsAttached)
                {
                    Object.Destroy(clientMoveEntity.gameObject);
                }
                else
                {
                    BoltNetwork.Destroy(clientMoveEntity.gameObject);
                }
            }

            clientMoveEntity = null;
            clientMoveState  = null;
        }